slavek-kucera created this revision.
slavek-kucera added a reviewer: uweigand.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Implement __builtin_eh_return_data_regno for SystemZ. Match behavior of GCC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84341

Files:
  clang/lib/Basic/Targets/SystemZ.h
  clang/test/CodeGen/builtins-systemz.c


Index: clang/test/CodeGen/builtins-systemz.c
===================================================================
--- clang/test/CodeGen/builtins-systemz.c
+++ clang/test/CodeGen/builtins-systemz.c
@@ -142,3 +142,11 @@
   result = __TM_failure_code (tdb);
 }
 
+void test_eh_return_data_regno()
+{
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 6
+  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 7
+  res = __builtin_eh_return_data_regno(2);  // CHECK: store volatile i32 8
+  res = __builtin_eh_return_data_regno(3);  // CHECK: store volatile i32 9
+}
Index: clang/lib/Basic/Targets/SystemZ.h
===================================================================
--- clang/lib/Basic/Targets/SystemZ.h
+++ clang/lib/Basic/Targets/SystemZ.h
@@ -157,6 +157,10 @@
   const char *getLongDoubleMangling() const override { return "g"; }
 
   bool hasExtIntType() const override { return true; }
+
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+    return RegNo < 4 ? 6 + RegNo : -1;
+  }
 };
 } // namespace targets
 } // namespace clang


Index: clang/test/CodeGen/builtins-systemz.c
===================================================================
--- clang/test/CodeGen/builtins-systemz.c
+++ clang/test/CodeGen/builtins-systemz.c
@@ -142,3 +142,11 @@
   result = __TM_failure_code (tdb);
 }
 
+void test_eh_return_data_regno()
+{
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 6
+  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 7
+  res = __builtin_eh_return_data_regno(2);  // CHECK: store volatile i32 8
+  res = __builtin_eh_return_data_regno(3);  // CHECK: store volatile i32 9
+}
Index: clang/lib/Basic/Targets/SystemZ.h
===================================================================
--- clang/lib/Basic/Targets/SystemZ.h
+++ clang/lib/Basic/Targets/SystemZ.h
@@ -157,6 +157,10 @@
   const char *getLongDoubleMangling() const override { return "g"; }
 
   bool hasExtIntType() const override { return true; }
+
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+    return RegNo < 4 ? 6 + RegNo : -1;
+  }
 };
 } // namespace targets
 } // namespace clang
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to