| 1 |
// RUN: clang-tblgen -I %p/../../include/ %s --gen-clang-builtins | FileCheck %s |
| 2 |
// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_LANES 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_LANES |
| 3 |
// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_COMMA 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_COMMA |
| 4 |
// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_TYPE 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_TYPE |
| 5 |
// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_A 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_A |
| 6 |
// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_B 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_B |
| 7 |
// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_C 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_C |
| 8 |
// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_D 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_D |
| 9 |
|
| 10 |
include "clang/Basic/BuiltinsBase.td" |
| 11 |
|
| 12 |
def : Builtin { |
| 13 |
// CHECK: Builtin::Info{{.*}} __builtin_01 {{.*}} /* E8idE4b */ |
| 14 |
let Prototype = "_ExtVector<8,int>(double, _ExtVector<4, bool>)"; |
| 15 |
let Spellings = ["__builtin_01"]; |
| 16 |
} |
| 17 |
|
| 18 |
def : Builtin { |
| 19 |
// CHECK: Builtin::Info{{.*}} __builtin_02 {{.*}} /* E8UiE4s */ |
| 20 |
let Prototype = "_ExtVector<8,unsigned int>(_ExtVector<4, short>)"; |
| 21 |
let Spellings = ["__builtin_02"]; |
| 22 |
} |
| 23 |
|
| 24 |
def : Builtin { |
| 25 |
// CHECK: Builtin::Info{{.*}} __builtin_03 {{.*}} /* di */ |
| 26 |
let Prototype = "double(int)"; |
| 27 |
let Spellings = ["__builtin_03"]; |
| 28 |
} |
| 29 |
|
| 30 |
def : Builtin { |
| 31 |
// CHECK: Builtin::Info{{.*}} __builtin_04 {{.*}} /* diIUi */ |
| 32 |
let Prototype = "double(int, _Constant unsigned int)"; |
| 33 |
let Spellings = ["__builtin_04"]; |
| 34 |
} |
| 35 |
|
| 36 |
def : Builtin { |
| 37 |
// CHECK: Builtin::Info{{.*}} __builtin_05 {{.*}} /* v&v& */ |
| 38 |
let Prototype = "void&(void&)"; |
| 39 |
let Spellings = ["__builtin_05"]; |
| 40 |
} |
| 41 |
|
| 42 |
def : Builtin { |
| 43 |
// CHECK: Builtin::Info{{.*}} __builtin_06 {{.*}} /* v*v*cC*. */ |
| 44 |
let Prototype = "void*(void*, char const*, ...)"; |
| 45 |
let Spellings = ["__builtin_06"]; |
| 46 |
} |
| 47 |
|
| 48 |
def : Builtin { |
| 49 |
// CHECK: Builtin::Info{{.*}} __builtin_07 {{.*}} /* E8iE4dE4b. */ |
| 50 |
let Prototype = "_ExtVector<8, int>(_ExtVector<4,double>, _ExtVector<4, bool>, ...)"; |
| 51 |
let Spellings = ["__builtin_07"]; |
| 52 |
} |
| 53 |
|
| 54 |
def : Builtin { |
| 55 |
// CHECK: Builtin::Info{{.*}} __builtin_08 {{.*}} /* di*R */ |
| 56 |
let Prototype = "double(int * restrict)"; |
| 57 |
let Spellings = ["__builtin_08"]; |
| 58 |
} |
| 59 |
|
| 60 |
def : Builtin { |
| 61 |
// CHECK: Builtin::Info{{.*}} __builtin_09 {{.*}} /* V2yy */ |
| 62 |
let Prototype = "_Vector<2, __bf16>(__bf16)"; |
| 63 |
let Spellings = ["__builtin_09"]; |
| 64 |
} |
| 65 |
|
| 66 |
#ifdef ERROR_EXPECTED_LANES |
| 67 |
def : Builtin { |
| 68 |
// ERROR_EXPECTED_LANES: :[[# @LINE + 1]]:7: error: Expected number of lanes after '_ExtVector<' |
| 69 |
let Prototype = "_ExtVector<int>(double)"; |
| 70 |
let Spellings = ["__builtin_test_use_clang_extended_vectors"]; |
| 71 |
} |
| 72 |
#endif |
| 73 |
|
| 74 |
#ifdef ERROR_EXPECTED_COMMA |
| 75 |
def : Builtin { |
| 76 |
// ERROR_EXPECTED_COMMA: :[[# @LINE + 1]]:7: error: Expected ',' after number of lanes in '_ExtVector<' |
| 77 |
let Prototype = "_ExtVector<8 int>(double)"; |
| 78 |
let Spellings = ["__builtin_test_use_clang_extended_vectors"]; |
| 79 |
} |
| 80 |
#endif |
| 81 |
|
| 82 |
#ifdef ERROR_EXPECTED_TYPE |
| 83 |
def : Builtin { |
| 84 |
// ERROR_EXPECTED_TYPE: :[[# @LINE + 1]]:7: error: Expected '>' after scalar type in '_ExtVector<N, type>' |
| 85 |
let Prototype = "_ExtVector<8, int (double)"; |
| 86 |
let Spellings = ["__builtin_test_use_clang_extended_vectors"]; |
| 87 |
} |
| 88 |
#endif |
| 89 |
|
| 90 |
#ifdef ERROR_EXPECTED_A |
| 91 |
def : Builtin { |
| 92 |
// ERROR_EXPECTED_A: :[[# @LINE + 1]]:7: error: Expected '<' after '_ExtVector' |
| 93 |
let Prototype = "_ExtVector(8, int) (double)"; |
| 94 |
let Spellings = ["__builtin_test_use_clang_extended_vectors"]; |
| 95 |
} |
| 96 |
#endif |
| 97 |
|
| 98 |
#ifdef ERROR_EXPECTED_B |
| 99 |
def : Builtin { |
| 100 |
// ERROR_EXPECTED_B: :[[# @LINE + 1]]:7: error: Expected '<' after '_ExtVector' |
| 101 |
let Prototype = "double(_ExtVector(8, int))"; |
| 102 |
let Spellings = ["__builtin_test_use_clang_extended_vectors"]; |
| 103 |
} |
| 104 |
#endif |
| 105 |
|
| 106 |
#ifdef ERROR_EXPECTED_C |
| 107 |
def : Builtin { |
| 108 |
// ERROR_EXPECTED_C: :[[# @LINE + 1]]:7: error: Unknown Type: _EtxVector<8, int> |
| 109 |
let Prototype = "_EtxVector<8, int>(void)"; |
| 110 |
let Spellings = ["__builtin_test_use_clang_extended_vectors"]; |
| 111 |
} |
| 112 |
#endif |
| 113 |
|
| 114 |
#ifdef ERROR_EXPECTED_D |
| 115 |
def : Builtin { |
| 116 |
// ERROR_EXPECTED_D: :[[# @LINE + 1]]:7: error: Expected number of lanes after '_ExtVector<' |
| 117 |
let Prototype = "_ExtVector<>(void)"; |
| 118 |
let Spellings = ["__builtin_test_use_clang_extended_vectors"]; |
| 119 |
} |
| 120 |
#endif |