1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
4 name: ashr_shl_to_sext_inreg
6 tracksRegLiveness: true
13 ; CHECK-LABEL: name: ashr_shl_to_sext_inreg
16 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
17 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
18 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s16) = G_SEXT_INREG [[TRUNC]], 8
19 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SEXT_INREG]](s16)
20 ; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32)
21 ; CHECK-NEXT: RET_ReallyLR implicit $w0
23 %0:_(s16) = G_TRUNC %1(s32)
24 %2:_(s16) = G_CONSTANT i16 8
25 %3:_(s16) = G_SHL %0, %2(s16)
26 %4:_(s16) = exact G_ASHR %3, %2(s16)
27 %5:_(s32) = G_ANYEXT %4(s16)
29 RET_ReallyLR implicit $w0
33 name: different_shift_amts
35 tracksRegLiveness: true
42 ; CHECK-LABEL: name: different_shift_amts
45 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
46 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
47 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 12
48 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 8
49 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s16) = G_SHL [[TRUNC]], [[C]](s16)
50 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s16) = exact G_ASHR [[SHL]], [[C1]](s16)
51 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ASHR]](s16)
52 ; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32)
53 ; CHECK-NEXT: RET_ReallyLR implicit $w0
55 %0:_(s16) = G_TRUNC %1(s32)
56 %2:_(s16) = G_CONSTANT i16 12
57 %4:_(s16) = G_CONSTANT i16 8
58 %3:_(s16) = G_SHL %0, %2(s16)
59 %5:_(s16) = exact G_ASHR %3, %4(s16)
60 %6:_(s32) = G_ANYEXT %5(s16)
62 RET_ReallyLR implicit $w0
66 name: ashr_shl_to_sext_inreg_vector
68 tracksRegLiveness: true
74 ; CHECK-LABEL: name: ashr_shl_to_sext_inreg_vector
77 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
78 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(<4 x s16>) = G_SEXT_INREG [[COPY]], 8
79 ; CHECK-NEXT: $d0 = COPY [[SEXT_INREG]](<4 x s16>)
80 ; CHECK-NEXT: RET_ReallyLR implicit $d0
81 %0:_(<4 x s16>) = COPY $d0
82 %2:_(s16) = G_CONSTANT i16 8
83 %1:_(<4 x s16>) = G_BUILD_VECTOR %2(s16), %2(s16), %2(s16), %2(s16)
84 %3:_(<4 x s16>) = G_SHL %0, %1(<4 x s16>)
85 %4:_(<4 x s16>) = exact G_ASHR %3, %1(<4 x s16>)
86 $d0 = COPY %4(<4 x s16>)
87 RET_ReallyLR implicit $d0