Sure, I believe it ok now to commit.

On 01/21/2013 11:56 AM, Hal Finkel wrote:
>
> Can you add a test case?
>
> Thanks again,
> Hal

>From 7e9b3f001edee5d489e0217486cd383037e7ddb7 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <[email protected]>
Date: Sun, 30 Dec 2012 05:37:16 -0600
Subject: [PATCH] PowerPC: fix __builtin_eh_return_data_regno return

---
 lib/Basic/Targets.cpp       |    5 +++++
 test/CodeGen/builtins-ppc.c |    9 +++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 test/CodeGen/builtins-ppc.c

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index c83165f..084b6b3 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -818,6 +818,11 @@ public:
   virtual const char *getClobbers() const {
     return "";
   }
+  int getEHDataRegisterNumber(unsigned RegNo) const {
+    if (RegNo == 0) return 3;
+    if (RegNo == 1) return 4;
+    return -1;
+  }
 };
 
 const Builtin::Info PPCTargetInfo::BuiltinInfo[] = {
diff --git a/test/CodeGen/builtins-ppc.c b/test/CodeGen/builtins-ppc.c
new file mode 100644
index 0000000..ee27a4c
--- /dev/null
+++ b/test/CodeGen/builtins-ppc.c
@@ -0,0 +1,9 @@
+// REQUIRES: ppc32-registered-target
+// RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+void test_eh_return_data_regno()
+{
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 3
+  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 4
+}
-- 
1.7.1

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to