diff --git a/clang/lib/Basic/Targets/SystemZ.h b/clang/lib/Basic/Targets/SystemZ.h --- a/clang/lib/Basic/Targets/SystemZ.h +++ b/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 diff --git a/clang/test/CodeGen/builtins-systemz.c b/clang/test/CodeGen/builtins-systemz.c --- a/clang/test/CodeGen/builtins-systemz.c +++ b/clang/test/CodeGen/builtins-systemz.c @@ -142,3 +142,10 @@ 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 +}