1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s 3 4... 5--- 6name: or_combine_sext 7tracksRegLiveness: true 8legalized: true 9body: | 10 bb.0: 11 liveins: $w0, $w1 12 ; or (sext X), (sext Y) --> sext (or X, Y) 13 ; 14 ; CHECK-LABEL: name: or_combine_sext 15 ; CHECK: liveins: $w0, $w1 16 ; CHECK: %x:_(s32) = COPY $w0 17 ; CHECK: %y:_(s32) = COPY $w1 18 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR %x, %y 19 ; CHECK: %logic_op:_(s64) = G_SEXT [[OR]](s32) 20 ; CHECK: $x0 = COPY %logic_op(s64) 21 ; CHECK: RET_ReallyLR implicit $x0 22 %x:_(s32) = COPY $w0 23 %y:_(s32) = COPY $w1 24 %hand1:_(s64) = G_SEXT %x(s32) 25 %hand2:_(s64) = G_SEXT %y(s32) 26 %logic_op:_(s64) = G_OR %hand1, %hand2 27 $x0 = COPY %logic_op(s64) 28 RET_ReallyLR implicit $x0 29 30... 31--- 32name: illegal_ty 33tracksRegLiveness: true 34legalized: true 35body: | 36 bb.0: 37 liveins: $w0, $w1 38 ; Post-legalization, we should not perform the optimization here, since 39 ; it would create an illegal G_OR. 40 ; 41 ; CHECK-LABEL: name: illegal_ty 42 ; CHECK: liveins: $w0, $w1 43 ; CHECK: %x_wide:_(s32) = COPY $w0 44 ; CHECK: %y_wide:_(s32) = COPY $w1 45 ; CHECK: %x:_(s1) = G_TRUNC %x_wide(s32) 46 ; CHECK: %y:_(s1) = G_TRUNC %y_wide(s32) 47 ; CHECK: %hand1:_(s64) = G_SEXT %x(s1) 48 ; CHECK: %hand2:_(s64) = G_SEXT %y(s1) 49 ; CHECK: %logic_op:_(s64) = G_OR %hand1, %hand2 50 ; CHECK: $x0 = COPY %logic_op(s64) 51 ; CHECK: RET_ReallyLR implicit $x0 52 %x_wide:_(s32) = COPY $w0 53 %y_wide:_(s32) = COPY $w1 54 %x:_(s1) = G_TRUNC %x_wide 55 %y:_(s1) = G_TRUNC %y_wide 56 %hand1:_(s64) = G_SEXT %x(s1) 57 %hand2:_(s64) = G_SEXT %y(s1) 58 %logic_op:_(s64) = G_OR %hand1, %hand2 59 $x0 = COPY %logic_op(s64) 60 RET_ReallyLR implicit $x0 61