[PATCH] D142583: [SPIR] Add support for __arithmetic_fence builtin for SPIR target.

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 11:18:51 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4b06d8ff826: __arithmetic_fence enforces ordering on expression evaluation when fast-math (authored by zahiraam).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142583

Files:
  clang/lib/Basic/Targets/SPIR.h
  clang/test/CodeGen/arithmetic-fence-builtin.c
  clang/test/Sema/arithmetic-fence-builtin.c


Index: clang/test/Sema/arithmetic-fence-builtin.c
===================================================================
--- clang/test/Sema/arithmetic-fence-builtin.c
+++ clang/test/Sema/arithmetic-fence-builtin.c
@@ -2,6 +2,7 @@
 // RUN: %clang_cc1 -triple ppc64le -DPPC     -emit-llvm -o - -verify -x c++ %s
 // RUN: not %clang_cc1 -triple ppc64le -DPPC     -emit-llvm -o - -x c++ %s \
 // RUN:            -fprotect-parens 2>&1 | FileCheck -check-prefix=PPC %s
+// RUN: %clang_cc1 -triple spir64 -emit-llvm -o - -verify -x c++ %s
 #ifndef PPC
 int v;
 template <typename T> T addT(T a, T b) {
Index: clang/test/CodeGen/arithmetic-fence-builtin.c
===================================================================
--- clang/test/CodeGen/arithmetic-fence-builtin.c
+++ clang/test/CodeGen/arithmetic-fence-builtin.c
@@ -12,6 +12,12 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -fprotect-parens\
 // RUN: -o - %s | FileCheck --implicit-check-not="llvm.arithmetic.fence" %s
 //
+// Test with fast math on spir target
+// RUN: %clang_cc1 -triple spir64  -emit-llvm -DFAST \
+// RUN: -mreassociate -o - %s \
+// RUN: | FileCheck --check-prefixes CHECK,CHECKFAST,CHECKNP %s
+//
+
 int v;
 int addit(float a, float b) {
   // CHECK: define {{.*}}@addit(float noundef %a, float noundef %b) #0 {
Index: clang/lib/Basic/Targets/SPIR.h
===================================================================
--- clang/lib/Basic/Targets/SPIR.h
+++ clang/lib/Basic/Targets/SPIR.h
@@ -191,6 +191,8 @@
   bool hasFeature(StringRef Feature) const override {
     return Feature == "spir";
   }
+
+  bool checkArithmeticFenceSupported() const override { return true; }
 };
 
 class LLVM_LIBRARY_VISIBILITY SPIR32TargetInfo : public SPIRTargetInfo {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142583.492528.patch
Type: text/x-patch
Size: 1742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230126/5066bbed/attachment.bin>


More information about the cfe-commits mailing list