================
@@ -0,0 +1,123 @@
+// RUN: cir-opt %s -cir-call-conv-lowering=target=x86_64 | FileCheck %s
+// RUN: cir-opt %s -cir-call-conv-lowering=target=x86_64 -cir-to-llvm -o - 
2>/dev/null \
+// RUN:   | mlir-translate -mlir-to-llvmir --allow-unregistered-dialect \
+// RUN:   | FileCheck %s --check-prefix=LLVM
+
+!u8i = !cir.int<u, 8>
+!s32i = !cir.int<s, 32>
+!s64i = !cir.int<s, 64>
+!rec_Empty = !cir.struct<"Empty" {pad !u8i}>
+!rec_HiWord = !cir.struct<"HiWord" {data !rec_Empty, data !s64i}>
+!rec_LeadPad = !cir.struct<"LeadPad" {pad !cir.array<!u8i x 8>, data !s32i}>
+
+module attributes {
+  cir.triple = "x86_64-unknown-linux-gnu",
+  dlti.dl_spec = #dlti.dl_spec<
+    #dlti.dl_entry<i8, dense<8>: vector<2xi64>>,
+    #dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
+    #dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
+} {
+
+  // HiWord is 16 bytes: a leading ABI-empty byte, then an i64 at offset 8.
+  // The low eightbyte carries no field (NO_CLASS), so the classifier passes
+  // the value in one register taken from byte 8.
+  cir.func @take_hiword(%arg0: !rec_HiWord) -> !s64i {
+    %0 = cir.alloca "h" align(8) : !cir.ptr<!rec_HiWord>
+    cir.store %arg0, %0 : !rec_HiWord, !cir.ptr<!rec_HiWord>
+    %1 = cir.get_member %0[1] {name = "hi"} : !cir.ptr<!rec_HiWord> -> 
!cir.ptr<!s64i>
+    %2 = cir.load %1 : !cir.ptr<!s64i>, !s64i
+    cir.return %2 : !s64i
+  }
+
+  // CHECK-LABEL: cir.func{{.*}} @take_hiword(%arg0: !s64i) -> !s64i
----------------
adams381 wrote:

OK.  I've made the change.

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

Reply via email to