[clang] 18526b0 - [PowerPC] Changed sema checking range for tdw td builtin
Albion Fung via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 26 16:44:44 PDT 2021
Author: Albion Fung
Date: 2021-07-26T18:44:33-05:00
New Revision: 18526b0d661f28e79cb70bfd712cedf9e7085154
URL: https://github.com/llvm/llvm-project/commit/18526b0d661f28e79cb70bfd712cedf9e7085154
DIFF: https://github.com/llvm/llvm-project/commit/18526b0d661f28e79cb70bfd712cedf9e7085154.diff
LOG: [PowerPC] Changed sema checking range for tdw td builtin
To match xlc behaviour and definition in the PowerPC ISA3.1,
it is a better idea to have ibm-clang produce an error when a
0 is passed to the builtin, which will match xlc's behaviour.
This patch changes the accepted range from 0 to 31 to 1 to 31.
Differential revision: https://reviews.llvm.org/D106817
Added:
Modified:
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/builtins-ppc-xlcompat-error.c
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index e00eef4c05dd..de75c10417e7 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3395,7 +3395,7 @@ bool Sema::CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
return SemaBuiltinConstantArgRange(TheCall, 3, 0, 7);
case PPC::BI__builtin_ppc_tw:
case PPC::BI__builtin_ppc_tdw:
- return SemaBuiltinConstantArgRange(TheCall, 2, 0, 31);
+ return SemaBuiltinConstantArgRange(TheCall, 2, 1, 31);
case PPC::BI__builtin_ppc_cmpeqb:
case PPC::BI__builtin_ppc_setb:
case PPC::BI__builtin_ppc_maddhd:
diff --git a/clang/test/CodeGen/builtins-ppc-xlcompat-error.c b/clang/test/CodeGen/builtins-ppc-xlcompat-error.c
index 1f18134f3292..28bf2e4df8d6 100644
--- a/clang/test/CodeGen/builtins-ppc-xlcompat-error.c
+++ b/clang/test/CodeGen/builtins-ppc-xlcompat-error.c
@@ -17,9 +17,11 @@ extern unsigned long ula;
void test_trap(void) {
#ifdef __PPC64__
- __tdw(lla, llb, 50); //expected-error {{argument value 50 is outside the valid range [0, 31]}}
+ __tdw(lla, llb, 50); //expected-error {{argument value 50 is outside the valid range [1, 31]}}
+ __tdw(lla, llb, 0); //expected-error {{argument value 0 is outside the valid range [1, 31]}}
#endif
- __tw(ia, ib, 50); //expected-error {{argument value 50 is outside the valid range [0, 31]}}
+ __tw(ia, ib, 50); //expected-error {{argument value 50 is outside the valid range [1, 31]}}
+ __tw(ia, ib, 0); //expected-error {{argument value 0 is outside the valid range [1, 31]}}
}
void test_builtin_ppc_rldimi() {
More information about the cfe-commits
mailing list