Skip to content

Commit 84167f8

Browse files
committed
Exclude invalid FC values for unsigned AMO load builtins
1 parent 9cb29f5 commit 84167f8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/Sema/SemaPPC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI,
261261
if (SemaRef.BuiltinConstantArg(TheCall, 2, Result))
262262
return true;
263263
unsigned Val = Result.getZExtValue();
264-
static constexpr unsigned ValidFC[] = {0, 1, 2, 3, 4, 6, 8, 16, 24, 25, 28};
264+
static constexpr unsigned ValidFC[] = {0, 1, 2, 3, 4, 6, 8};
265265
if (llvm::is_contained(ValidFC, Val))
266266
return false;
267267
Expr *Arg = TheCall->getArg(2);
268268
return SemaRef.Diag(Arg->getBeginLoc(), diag::err_argument_invalid_range)
269-
<< toString(Result, 10) << "0-4, 6, 8, 16, 24-25" << "28"
269+
<< toString(Result, 10) << "0-4, 6" << "8"
270270
<< Arg->getSourceRange();
271271
}
272272
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ void test_amo() {
77
unsigned int *ptr1, value1;
88
// AIX32-ERROR: error: this builtin is only available on 64-bit targets
99
__builtin_amo_lwat(ptr1, value1, 0);
10-
// FC-ERROR: argument value 9 is outside the valid range [0-4, 6, 8, 16, 24-25, 28]
10+
// 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;
1414
// AIX32-ERROR: error: this builtin is only available on 64-bit targets
1515
__builtin_amo_ldat(ptr2, value2, 3);
16-
// FC-ERROR: error: argument value 26 is outside the valid range [0-4, 6, 8, 16, 24-25, 28]
16+
// FC-ERROR: error: argument value 26 is outside the valid range [0-4, 6, 8]
1717
__builtin_amo_ldat(ptr2, value2, 26);
1818
}

0 commit comments

Comments
 (0)