Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SystemZ] Emit a .gnu_attribute for an externally visible vector abi.
On SystemZ, the vector ABI changes depending on the presence of hardware vector support. Therefore, each binary compiled with a visible vector ABI (e.g. one that calls an external function with a vector argument) should be marked with a .gnu_attribute describing this. Reviewed By: uweigand Differential Revision: https://reviews.llvm.org/D105067
- Loading branch information
Showing
31 changed files
with
641 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -target-cpu arch10 -emit-llvm \ | ||
// RUN: -fzvector -o - %s 2>&1 | FileCheck %s --check-prefix=MODFLAG | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// RUN: %clang_cc1 -triple s390x-ibm-linux -target-cpu arch10 -S \ | ||
// RUN: -fzvector -o - %s 2>&1 | FileCheck %s --check-prefix=ARCH10-ASM | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -target-cpu arch13 -S \ | ||
// RUN: -fzvector -o - %s 2>&1 | FileCheck %s --check-prefix=ARCH13-ASM | ||
// | ||
// Test the emission of a gnu attribute describing the vector ABI. | ||
|
||
// Call to external function with vector argument. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
void bar(v4i32 Arg); | ||
|
||
void foo() { | ||
v4i32 Var = {0, 0, 0, 0}; | ||
bar(Var); | ||
} | ||
|
||
//MODFLAG: !llvm.module.flags = !{!0, !1} | ||
//MODFLAG: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} | ||
|
||
//ARCH10-ASM: .gnu_attribute 8, 1 | ||
//ARCH13-ASM: .gnu_attribute 8, 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -target-cpu arch13 -emit-llvm \ | ||
// RUN: -fzvector -o - %s 2>&1 | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Call to external function with vector return value. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
v4i32 bar(void); | ||
|
||
void foo(v4i32 *Dst) { | ||
v4i32 Var = bar(); | ||
*Dst = Var; | ||
} | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test that the "s390x-visible-vector-ABI" module flag is not emitted. | ||
|
||
// Call to external function *without* vector argument. | ||
|
||
void bar(int arg); | ||
|
||
void foo() { | ||
int Var = 0; | ||
bar(Var); | ||
} | ||
|
||
//CHECK-NOT: !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s \ | ||
// RUN: -Wno-undefined-internal 2>&1 | FileCheck %s | ||
// | ||
// Test that the "s390x-visible-vector-ABI" module flag is not emitted. | ||
|
||
// Calling *local* function with vector argument. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
static void bar(v4i32 arg); | ||
|
||
void foo() { | ||
v4i32 Var = {0, 0, 0, 0}; | ||
bar(Var); | ||
} | ||
|
||
//CHECK-NOT: !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Call via global function pointer in internal function, with vector argument. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
void (*bar)(v4i32 Arg); | ||
|
||
static void foo() { | ||
v4i32 Var = {0, 0, 0, 0}; | ||
(*bar)(Var); | ||
} | ||
|
||
void fun() { foo(); } | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Call via global function pointer in internal function, with vector return | ||
// value. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
v4i32 (*bar)(int); | ||
|
||
static int foo() { | ||
(*bar)(0)[0]; | ||
} | ||
|
||
int fun() { return foo(); } | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Passing address of local function with vector arg to global function. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
void GlobFun(v4i32 (*f)(v4i32)); | ||
|
||
static v4i32 foo(v4i32 Arg) { | ||
return Arg; | ||
} | ||
|
||
void fun() { | ||
GlobFun(foo); | ||
} | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Passing an array of vectors. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
void bar(v4i32 Arg[2]); | ||
|
||
void foo() { | ||
v4i32 Var[2] = {{0, 0, 0, 0}, {0, 0, 0, 0}}; | ||
bar(Var); | ||
} | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Passing a struct containing a vector element. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
struct S { | ||
int A; | ||
v4i32 B; | ||
}; | ||
|
||
void bar(struct S Arg); | ||
|
||
void foo() { | ||
struct S Var = {0, {0, 0, 0, 0}}; | ||
bar(Var); | ||
} | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Call to vararg function with a vector argument. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
void bar(int N, ...); | ||
|
||
void foo() { | ||
v4i32 Var = {0, 0, 0, 0}; | ||
bar(0, Var); | ||
} | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Call to vararg function *without* any vector argument. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
void bar(int N, ...); | ||
|
||
void foo() { | ||
int Var = 0; | ||
bar(0, Var); | ||
} | ||
|
||
//CHECK-NOT: !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// | ||
// Test the emission of the "s390x-visible-vector-ABI" module flag. | ||
|
||
// Call to varargs function via global pointer to pointer to function. | ||
|
||
typedef __attribute__((vector_size(16))) int v4i32; | ||
|
||
void (**bar)(int N, ...); | ||
|
||
void foo() { | ||
v4i32 Var = {0, 0, 0, 0}; | ||
(**bar)(0, Var); | ||
} | ||
|
||
//CHECK: !llvm.module.flags = !{!0, !1} | ||
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1} |
Oops, something went wrong.