Skip to content

Commit 06562e2

Browse files
committed
Add 64-bit target check for signed AMO builtins
1 parent 5a7467a commit 06562e2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

clang/lib/Sema/SemaPPC.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static bool isPPC_64Builtin(unsigned BuiltinID) {
8989
case PPC::BI__builtin_ppc_fetch_and_swaplp:
9090
case PPC::BI__builtin_amo_lwat:
9191
case PPC::BI__builtin_amo_ldat:
92+
case PPC::BI__builtin_amo_lwat_s:
93+
case PPC::BI__builtin_amo_ldat_s:
9294
return true;
9395
}
9496
return false;

clang/test/CodeGen/PowerPC/builtins-amo-err.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55

66
void test_amo() {
77
unsigned int *ptr1, value1;
8-
// AIX32-ERROR: error: this builtin is only available on 64-bit targets
8+
// AIX32-ERROR-COUNT-2: error: this builtin is only available on 64-bit targets
99
__builtin_amo_lwat(ptr1, value1, 0);
1010
// FC-ERROR: argument value 9 is outside the valid range [0-4, 6, 8]
1111
__builtin_amo_lwat(ptr1, value1, 9);
1212

1313
unsigned long int *ptr2, value2;
14-
// AIX32-ERROR: error: this builtin is only available on 64-bit targets
14+
// AIX32-ERROR-COUNT-2: error: this builtin is only available on 64-bit targets
1515
__builtin_amo_ldat(ptr2, value2, 3);
1616
// FC-ERROR: error: argument value 26 is outside the valid range [0-4, 6, 8]
1717
__builtin_amo_ldat(ptr2, value2, 26);
1818

1919
signed int *ptr3, value3;
20-
// AIX32-ERROR: error: this builtin is only available on 64-bit targets
20+
// AIX32-ERROR-COUNT-2: error: this builtin is only available on 64-bit targets
2121
__builtin_amo_lwat_s(ptr3, value3, 0);
2222
// FC-ERROR: argument value 2 is outside the valid range [0, 5, 7, 8]
2323
__builtin_amo_lwat_s(ptr3, value3, 2);
2424

25-
unsigned long int *ptr4, value4;
26-
// AIX32-ERROR: error: this builtin is only available on 64-bit targets
27-
__builtin_amo_ldat_s(ptr4, value4, 3);
25+
signed long int *ptr4, value4;
26+
// AIX32-ERROR-COUNT-2: error: this builtin is only available on 64-bit targets
27+
__builtin_amo_ldat_s(ptr4, value4, 5);
2828
// FC-ERROR: error: argument value 6 is outside the valid range [0, 5, 7, 8]
2929
__builtin_amo_ldat_s(ptr4, value4, 6);
3030
}

0 commit comments

Comments
 (0)