[PATCH] D128120: [Clang][VE] Add missing intrinsics

Kazushi Marukawa via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 20 15:30:41 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ba0a9571b3e: [Clang][VE] Add missing intrinsics (authored by kaz7).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128120

Files:
  clang/include/clang/Basic/BuiltinsVE.def
  clang/test/CodeGen/VE/ve-velintrin.c


Index: clang/test/CodeGen/VE/ve-velintrin.c
===================================================================
--- clang/test/CodeGen/VE/ve-velintrin.c
+++ clang/test/CodeGen/VE/ve-velintrin.c
@@ -1,7 +1,7 @@
 // REQUIRES: ve-registered-target
 
-// RUN: %clang_cc1 -no-opaque-pointers -S -emit-llvm -triple ve-unknown-linux-gnu \
-// RUN:   -ffreestanding %s -o - | FileCheck %s
+// RUN: %clang_cc1 -S -emit-llvm -triple ve-unknown-linux-gnu \
+// RUN:   -no-opaque-pointers -ffreestanding %s -o - | FileCheck %s
 
 #include <velintrin.h>
 
@@ -8811,3 +8811,48 @@
   // CHECK: call void @llvm.ve.vl.svob()
   _vel_svob();
 }
+
+void __attribute__((noinline))
+test_pack_f32p(float* p1, float* p2) {
+  // CHECK-LABEL: @test_pack_f32p
+  // CHECK: %[[VAR1:[A-Za-z0-9.]+]] = bitcast float* %{{.*}} to i8*
+  // CHECK: %[[VAR2:[A-Za-z0-9.]+]] = bitcast float* %{{.*}} to i8*
+  // CHECK-NEXT: call i64 @llvm.ve.vl.pack.f32p(i8* %[[VAR1]], i8* %[[VAR2]])
+  v1 = _vel_pack_f32p(p1, p2);
+}
+
+void __attribute__((noinline))
+test_pack_f32a(float* p) {
+  // CHECK-LABEL: @test_pack_f32a
+  // CHECK: %[[VAR3:[A-Za-z0-9.]+]] = bitcast float* %{{.*}} to i8*
+  // CHECK-NEXT: call i64 @llvm.ve.vl.pack.f32a(i8* %[[VAR3]])
+  v1 = _vel_pack_f32a(p);
+}
+
+void __attribute__((noinline))
+test_extract_vm512u() {
+  // CHECK-LABEL: @test_extract_vm512u
+  // CHECK: call <256 x i1> @llvm.ve.vl.extract.vm512u(<512 x i1> %{{.*}})
+  vm1 = _vel_extract_vm512u(vm1_512);
+}
+
+void __attribute__((noinline))
+test_extract_vm512l() {
+  // CHECK-LABEL: @test_extract_vm512l
+  // CHECK: call <256 x i1> @llvm.ve.vl.extract.vm512l(<512 x i1> %{{.*}})
+  vm1 = _vel_extract_vm512l(vm1_512);
+}
+
+void __attribute__((noinline))
+test_insert_vm512u() {
+  // CHECK-LABEL: @test_insert_vm512u
+  // CHECK: call <512 x i1> @llvm.ve.vl.insert.vm512u(<512 x i1> %{{.*}}, <256 x i1> %{{.*}})
+  vm1_512 = _vel_insert_vm512u(vm1_512, vm1);
+}
+
+void __attribute__((noinline))
+test_insert_vm512l() {
+  // CHECK-LABEL: @test_insert_vm512l
+  // CHECK: call <512 x i1> @llvm.ve.vl.insert.vm512l(<512 x i1> %{{.*}}, <256 x i1> %{{.*}})
+  vm1_512 = _vel_insert_vm512l(vm1_512, vm1);
+}
Index: clang/include/clang/Basic/BuiltinsVE.def
===================================================================
--- clang/include/clang/Basic/BuiltinsVE.def
+++ clang/include/clang/Basic/BuiltinsVE.def
@@ -15,6 +15,16 @@
 #   define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
 #endif
 
+// The format of this database is decribed in clang/Basic/Builtins.def.
+
+BUILTIN(__builtin_ve_vl_pack_f32p, "ULifC*fC*", "n")
+BUILTIN(__builtin_ve_vl_pack_f32a, "ULifC*", "n")
+
+BUILTIN(__builtin_ve_vl_extract_vm512u, "V256bV512b", "n")
+BUILTIN(__builtin_ve_vl_extract_vm512l, "V256bV512b", "n")
+BUILTIN(__builtin_ve_vl_insert_vm512u, "V512bV512bV256b", "n")
+BUILTIN(__builtin_ve_vl_insert_vm512l, "V512bV512bV256b", "n")
+
 // Use generated BUILTIN definitions
 #include "clang/Basic/BuiltinsVEVL.gen.def"
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128120.438490.patch
Type: text/x-patch
Size: 2996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220620/248a5841/attachment.bin>


More information about the cfe-commits mailing list