[clang] bff8356 - Revert "[COFF, ARM64] Add __break intrinsic"

Pengxuan Zheng via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 11:58:24 PDT 2022


Author: Pengxuan Zheng
Date: 2022-04-20T11:57:49-07:00
New Revision: bff8356b1969d2edd02e22c73d1c3d386f862937

URL: https://github.com/llvm/llvm-project/commit/bff8356b1969d2edd02e22c73d1c3d386f862937
DIFF: https://github.com/llvm/llvm-project/commit/bff8356b1969d2edd02e22c73d1c3d386f862937.diff

LOG: Revert "[COFF, ARM64] Add __break intrinsic"

This reverts commit 8a9b4fb4aa6d2dde026d9ae08459aa9e7a1edb05.

Added: 
    

Modified: 
    clang/include/clang/Basic/BuiltinsAArch64.def
    clang/lib/CodeGen/CGBuiltin.cpp
    clang/lib/Headers/intrin.h
    clang/lib/Sema/SemaChecking.cpp
    clang/test/CodeGen/arm64-microsoft-intrinsics.c
    clang/test/Sema/builtins-microsoft-arm64.c
    llvm/include/llvm/IR/IntrinsicsAArch64.td
    llvm/lib/Target/AArch64/AArch64InstrFormats.td
    llvm/lib/Target/AArch64/AArch64InstrInfo.td

Removed: 
    llvm/test/CodeGen/AArch64/arm64-break.ll


################################################################################
diff  --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def
index cebd1c07fbcc9..0869b87e32fb9 100644
--- a/clang/include/clang/Basic/BuiltinsAArch64.def
+++ b/clang/include/clang/Basic/BuiltinsAArch64.def
@@ -249,8 +249,6 @@ TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", ALL_MS_LA
 TARGET_HEADER_BUILTIN(__mulh,  "SLLiSLLiSLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__umulh, "ULLiULLiULLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
 
-TARGET_HEADER_BUILTIN(__break, "vi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-
 #undef BUILTIN
 #undef LANGBUILTIN
 #undef TARGET_HEADER_BUILTIN

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index fc2d32f3e26fe..464dcc2d8621c 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -9823,15 +9823,6 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
     return Builder.CreateCall(F, Metadata);
   }
 
-  if (BuiltinID == AArch64::BI__break) {
-    Expr::EvalResult Result;
-    if (!E->getArg(0)->EvaluateAsInt(Result, CGM.getContext()))
-      llvm_unreachable("Sema will ensure that the parameter is constant");
-
-    llvm::Function *F = CGM.getIntrinsic(llvm::Intrinsic::aarch64_break);
-    return Builder.CreateCall(F, {EmitScalarExpr(E->getArg(0))});
-  }
-
   if (BuiltinID == AArch64::BI__builtin_arm_clrex) {
     Function *F = CGM.getIntrinsic(Intrinsic::aarch64_clrex);
     return Builder.CreateCall(F);

diff  --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h
index 07fcae36020d7..741b21eef32a6 100644
--- a/clang/lib/Headers/intrin.h
+++ b/clang/lib/Headers/intrin.h
@@ -560,8 +560,6 @@ unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 val);
 
 __int64 __mulh(__int64 __a, __int64 __b);
 unsigned __int64 __umulh(unsigned __int64 __a, unsigned __int64 __b);
-
-void __break(int);
 #endif
 
 /*----------------------------------------------------------------------------*\

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 467edd3321b9d..f575c0775e7f9 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2948,9 +2948,6 @@ bool Sema::CheckAArch64BuiltinFunctionCall(const TargetInfo &TI,
   if (BuiltinID == AArch64::BI__getReg)
     return SemaBuiltinConstantArgRange(TheCall, 0, 0, 31);
 
-  if (BuiltinID == AArch64::BI__break)
-    return SemaBuiltinConstantArgRange(TheCall, 0, 0, 0xffff);
-
   if (CheckNeonBuiltinFunctionCall(TI, BuiltinID, TheCall))
     return true;
 

diff  --git a/clang/test/CodeGen/arm64-microsoft-intrinsics.c b/clang/test/CodeGen/arm64-microsoft-intrinsics.c
index 044a6a1cdff58..2dd2f6c8f0351 100644
--- a/clang/test/CodeGen/arm64-microsoft-intrinsics.c
+++ b/clang/test/CodeGen/arm64-microsoft-intrinsics.c
@@ -103,13 +103,6 @@ unsigned long long check_umulh(unsigned long long a, unsigned long long b) {
 // CHECK-MSVC: %[[RES:.*]] = trunc i128 %[[HIGH]] to i64
 // CHECK-LINUX: error: call to undeclared function '__umulh'
 
-void check__break() {
-  __break(0);
-}
-
-// CHECK-MSVC: call void @llvm.aarch64.break(i32 0)
-// CHECK-LINUX: error: implicit declaration of function '__break'
-
 unsigned __int64 check__getReg(void) {
   unsigned volatile __int64 reg;
   reg = __getReg(18);

diff  --git a/clang/test/Sema/builtins-microsoft-arm64.c b/clang/test/Sema/builtins-microsoft-arm64.c
index 6d0dc09c9ed83..3b5bd9b9bf866 100644
--- a/clang/test/Sema/builtins-microsoft-arm64.c
+++ b/clang/test/Sema/builtins-microsoft-arm64.c
@@ -3,12 +3,6 @@
 
 #include <intrin.h>
 
-void check__break(int x) {
-  __break(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
-  __break(65536); // expected-error-re {{argument value {{.*}} is outside the valid range}}
-  __break(x); // expected-error {{argument to '__break' must be a constant integer}}
-}
-
 void check__getReg(void) {
   __getReg(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
   __getReg(32); // expected-error-re {{argument value {{.*}} is outside the valid range}}

diff  --git a/llvm/include/llvm/IR/IntrinsicsAArch64.td b/llvm/include/llvm/IR/IntrinsicsAArch64.td
index 3032254d13f89..a65ddff07a29e 100644
--- a/llvm/include/llvm/IR/IntrinsicsAArch64.td
+++ b/llvm/include/llvm/IR/IntrinsicsAArch64.td
@@ -62,9 +62,6 @@ def int_aarch64_frint64x
 
 def int_aarch64_hint : DefaultAttrsIntrinsic<[], [llvm_i32_ty]>;
 
-def int_aarch64_break : Intrinsic<[], [llvm_i32_ty],
-    [IntrNoMem, IntrHasSideEffects, IntrNoReturn, IntrCold, ImmArg<ArgIndex<0>>]>;
-
 //===----------------------------------------------------------------------===//
 // Data Barrier Instructions
 

diff  --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 37928aa6fe5dc..e7d37c3ab5d4b 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -4529,9 +4529,8 @@ multiclass MemTagStore<bits<2> opc1, string insn> {
 //---
 
 let mayLoad = 0, mayStore = 0, hasSideEffects = 1 in
-class ExceptionGeneration<bits<3> op1, bits<2> ll, string asm,
-                          list<dag> pattern = []>
-    : I<(outs), (ins timm32_0_65535:$imm), asm, "\t$imm", "", pattern>,
+class ExceptionGeneration<bits<3> op1, bits<2> ll, string asm>
+    : I<(outs), (ins timm32_0_65535:$imm), asm, "\t$imm", "", []>,
       Sched<[WriteSys]> {
   bits<16> imm;
   let Inst{31-24} = 0b11010100;

diff  --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index baf6b5e9b246f..d626bf86f740f 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -2432,8 +2432,7 @@ def : Pat<(AArch64call texternalsym:$func), (BL texternalsym:$func)>;
 // Exception generation instructions.
 //===----------------------------------------------------------------------===//
 let isTrap = 1 in {
-def BRK   : ExceptionGeneration<0b001, 0b00, "brk",
-                                [(int_aarch64_break timm32_0_65535:$imm)]>;
+def BRK   : ExceptionGeneration<0b001, 0b00, "brk">;
 }
 def DCPS1 : ExceptionGeneration<0b101, 0b01, "dcps1">;
 def DCPS2 : ExceptionGeneration<0b101, 0b10, "dcps2">;

diff  --git a/llvm/test/CodeGen/AArch64/arm64-break.ll b/llvm/test/CodeGen/AArch64/arm64-break.ll
deleted file mode 100644
index 3b8b14b61d1cf..0000000000000
--- a/llvm/test/CodeGen/AArch64/arm64-break.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
-
-define void @foo() nounwind {
-; CHECK-LABEL: foo
-; CHECK: brk #0x2
-  tail call void @llvm.aarch64.break(i32 2)
-  ret void
-}
-
-declare void @llvm.aarch64.break(i32 immarg) nounwind


        


More information about the cfe-commits mailing list