summaryrefslogtreecommitdiff
path: root/test/CodeGen/AArch64/GlobalISel/select-trunc.mir
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/AArch64/GlobalISel/select-trunc.mir')
-rw-r--r--test/CodeGen/AArch64/GlobalISel/select-trunc.mir81
1 files changed, 81 insertions, 0 deletions
diff --git a/test/CodeGen/AArch64/GlobalISel/select-trunc.mir b/test/CodeGen/AArch64/GlobalISel/select-trunc.mir
new file mode 100644
index 0000000000000..fc3546e777f70
--- /dev/null
+++ b/test/CodeGen/AArch64/GlobalISel/select-trunc.mir
@@ -0,0 +1,81 @@
+# RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s
+
+--- |
+ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+
+ define void @trunc_s32_s64() { ret void }
+ define void @trunc_s8_s64() { ret void }
+ define void @trunc_s1_s32() { ret void }
+...
+
+---
+# CHECK-LABEL: name: trunc_s32_s64
+name: trunc_s32_s64
+legalized: true
+regBankSelected: true
+
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr64 }
+# CHECK-NEXT: - { id: 1, class: gpr32 }
+registers:
+ - { id: 0, class: gpr }
+ - { id: 1, class: gpr }
+
+# CHECK: body:
+# CHECK: %1 = COPY %0.sub_32
+body: |
+ bb.0:
+ liveins: %x0
+
+ %0(s64) = COPY %x0
+ %1(s32) = G_TRUNC %0
+ %w0 = COPY %1(s32)
+...
+
+---
+# CHECK-LABEL: name: trunc_s8_s64
+name: trunc_s8_s64
+legalized: true
+regBankSelected: true
+
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr64 }
+# CHECK-NEXT: - { id: 1, class: gpr32 }
+registers:
+ - { id: 0, class: gpr }
+ - { id: 1, class: gpr }
+
+# CHECK: body:
+# CHECK: %1 = COPY %0.sub_32
+body: |
+ bb.0:
+ liveins: %x0
+
+ %0(s64) = COPY %x0
+ %1(s8) = G_TRUNC %0
+ %w0 = COPY %1(s8)
+...
+
+---
+# CHECK-LABEL: name: trunc_s1_s32
+name: trunc_s1_s32
+legalized: true
+regBankSelected: true
+
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr32 }
+# CHECK-NEXT: - { id: 1, class: gpr32 }
+registers:
+ - { id: 0, class: gpr }
+ - { id: 1, class: gpr }
+
+# CHECK: body:
+# CHECK: %1 = COPY %0
+body: |
+ bb.0:
+ liveins: %w0
+
+ %0(s32) = COPY %w0
+ %1(s1) = G_TRUNC %0
+ %w0 = COPY %1(s1)
+...