================
@@ -0,0 +1,182 @@
+// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-linux 
-target-feature +xsave -target-feature +xsaveopt -target-feature +xsavec 
-target-feature +xsaves -fclangir -emit-cir -o %t.cir -Wall -Werror
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-linux 
-target-feature +xsave -target-feature +xsaveopt -target-feature +xsavec 
-target-feature +xsaves -fclangir -emit-llvm -o %t.ll -Wall -Werror
+// RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
+
+// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-linux 
-target-feature +xsave -target-feature +xsaveopt -target-feature +xsavec 
-target-feature +xsaves -emit-llvm -o - -Wall -Werror | FileCheck %s 
-check-prefix=OGCG
+
+void test_xsave(void *p, unsigned long long m) {
+  // CIR-LABEL: test_xsave
+  // CIR: cir.const #cir.int<32> : !s64i
+  // CIR: cir.shift(right, {{.*}} : !u64i, {{.*}} : !s64i) -> !u64i
+  // CIR: cir.cast integral %{{.*}} : !u64i -> !s32i
+  // CIR: cir.cast integral %{{.*}} : !u64i -> !s32i
+  // CIR: cir.call_llvm_intrinsic "x86.xsave"
----------------
andykaylor wrote:

```suggestion
  // CIR: [[P:.*]] = cir.load
  // CIR: [[M:.*]] = cir.load
  // CIR: [[CONST:.*]] = cir.const #cir.int<32> : !s64i
  // CIR: [[SHIFT:.*]] = cir.shift(right, [[M]] : !u64i, [[CONST]] : !s64i) -> 
!u64i
  // CIR: [[CAST1:.*]] = cir.cast integral %[[SHIFT]] : !u64i -> !s32i
  // CIR: [[CAST2:.*]] = cir.cast integral %[[M]] : !u64i -> !s32i
  // CIR: cir.call_llvm_intrinsic "x86.xsave" %[[P]], %[[CAST1]], %[[CAST2]]
```
This is the level of detail I was hoping to see, here and in the LLVM and OGCG 
checks for this case. I want to be able to see the entire use-def flow. It's 
fine to omit it for the others though, since as you noted they follow the same 
pattern, though a comment explaining that would be useful.

https://github.com/llvm/llvm-project/pull/170877
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to