[PATCH] D107138: [PowerPC] Implement cmplxl builtins

Albion Fung via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 4 12:45:08 PDT 2021


Conanap updated this revision to Diff 364223.
Conanap marked 6 inline comments as done.
Conanap added a comment.

Removed backend tests, removed some uneeded definitions,
updated frontend test with regex for variable names.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107138/new/

https://reviews.llvm.org/D107138

Files:
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/CodeGen/builtins-ppc-xlcompat-complex.c


Index: clang/test/CodeGen/builtins-ppc-xlcompat-complex.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/builtins-ppc-xlcompat-complex.c
@@ -0,0 +1,30 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -O2 -triple powerpc64-unknown-unknown \
+// RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
+// RUN: %clang_cc1 -O2 -triple powerpc64le-unknown-unknown \
+// RUN:   -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
+// RUN: %clang_cc1 -O2 -triple powerpc-unknown-aix \
+// RUN:   -emit-llvm %s -o - -target-cpu pwr7 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -O2 -triple powerpc64-unknown-aix \
+// RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s \
+// RUN:   --check-prefix=CHECK-AIX
+
+extern long double lda, ldb;
+
+long double _Complex test_xl_cmplxl() {
+  // CHECK-LABEL: test_xl_cmplxl
+  // CHECK: %0 = load ppc_fp128, ppc_fp128* @lda
+  // CHECK-NEXT: %1 = load ppc_fp128, ppc_fp128* @ldb
+  // CHECK-NEXT: [[VAR1:%.*]] = insertvalue { ppc_fp128, ppc_fp128 } undef, ppc_fp128 %0, 0
+  // CHECK-NEXT: [[VAR2:%.*]] = insertvalue { ppc_fp128, ppc_fp128 } [[VAR1]], ppc_fp128 %1, 1
+  // CHECK-NEXT: ret { ppc_fp128, ppc_fp128 } [[VAR2]]
+
+  // CHECK-AIX-LABEL: test_xl_cmplxl
+  // CHECK-AIX: %0 = load double, double* @lda
+  // CHECK-AIX-NEXT: %1 = load double, double* @ldb
+  // CHECK-AIX-NEXT: [[VAR3:%.*]] = insertvalue { double, double } undef, double %0, 0
+  // CHECK-AIX-NEXT: [[VAR4:%.*]] = insertvalue { double, double } [[VAR3]], double %1, 1
+  // CHECK-AIX-NEXT: ret { double, double } [[VAR4]]
+  return __cmplxl(lda, ldb);
+}
Index: clang/lib/Basic/Targets/PPC.cpp
===================================================================
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -235,6 +235,7 @@
   Builder.defineMacro("__frsqrtes", "__builtin_ppc_frsqrtes");
   Builder.defineMacro("__fsqrt", "__builtin_ppc_fsqrt");
   Builder.defineMacro("__fsqrts", "__builtin_ppc_fsqrts");
+  Builder.defineMacro("__cmplxl", "__builtin_complex");
 }
 
 /// PPCTargetInfo::getTargetDefines - Return a set of the PowerPC-specific


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107138.364223.patch
Type: text/x-patch
Size: 2193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210804/9abe8505/attachment.bin>


More information about the cfe-commits mailing list