1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -O0 -mtriple=aarch64-linux-gnu -global-isel -stop-after=irtranslator %s -o - | FileCheck %s
4 define i32 @call_trunc_no_flags(i64 %a) {
5 ; CHECK-LABEL: name: call_trunc_no_flags
7 ; CHECK-NEXT: liveins: $x0
9 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
10 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
11 ; CHECK-NEXT: $w0 = COPY [[TRUNC]](s32)
12 ; CHECK-NEXT: RET_ReallyLR implicit $w0
14 %result = trunc i64 %a to i32
18 define i32 @call_trunc_nsw_flags(i64 %a) {
19 ; CHECK-LABEL: name: call_trunc_nsw_flags
21 ; CHECK-NEXT: liveins: $x0
23 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
24 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = nsw G_TRUNC [[COPY]](s64)
25 ; CHECK-NEXT: $w0 = COPY [[TRUNC]](s32)
26 ; CHECK-NEXT: RET_ReallyLR implicit $w0
28 %result = trunc nsw i64 %a to i32
32 define i32 @call_trunc_nuw_flags(i64 %a) {
33 ; CHECK-LABEL: name: call_trunc_nuw_flags
35 ; CHECK-NEXT: liveins: $x0
37 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
38 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = nuw G_TRUNC [[COPY]](s64)
39 ; CHECK-NEXT: $w0 = COPY [[TRUNC]](s32)
40 ; CHECK-NEXT: RET_ReallyLR implicit $w0
42 %result = trunc nuw i64 %a to i32
46 define i32 @call_trunc_all_flags(i64 %a) {
47 ; CHECK-LABEL: name: call_trunc_all_flags
49 ; CHECK-NEXT: liveins: $x0
51 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
52 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = nuw nsw G_TRUNC [[COPY]](s64)
53 ; CHECK-NEXT: $w0 = COPY [[TRUNC]](s32)
54 ; CHECK-NEXT: RET_ReallyLR implicit $w0
56 %result = trunc nsw nuw i64 %a to i32
60 define <2 x i64> @call_trunc_noop_signed_vector(<2 x i64> %a) {
61 ; CHECK-LABEL: name: call_trunc_noop_signed_vector
63 ; CHECK-NEXT: liveins: $q0
65 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
66 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(<2 x s32>) = nsw G_TRUNC [[COPY]](<2 x s64>)
67 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(<2 x s64>) = G_SEXT [[TRUNC]](<2 x s32>)
68 ; CHECK-NEXT: $q0 = COPY [[SEXT]](<2 x s64>)
69 ; CHECK-NEXT: RET_ReallyLR implicit $q0
71 %truncate = trunc nsw <2 x i64> %a to <2 x i32>
72 %result = sext <2 x i32> %truncate to <2 x i64>
76 define <2 x i64> @call_trunc_noop_unsigned_vector(<2 x i64> %a) {
77 ; CHECK-LABEL: name: call_trunc_noop_unsigned_vector
79 ; CHECK-NEXT: liveins: $q0
81 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
82 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(<2 x s32>) = nuw G_TRUNC [[COPY]](<2 x s64>)
83 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(<2 x s64>) = G_ZEXT [[TRUNC]](<2 x s32>)
84 ; CHECK-NEXT: $q0 = COPY [[ZEXT]](<2 x s64>)
85 ; CHECK-NEXT: RET_ReallyLR implicit $q0
87 %truncate = trunc nuw <2 x i64> %a to <2 x i32>
88 %result = zext <2 x i32> %truncate to <2 x i64>