1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -verify-machineinstrs -mtriple aarch64-unknown-uknown -global-isel -run-pass=instruction-select %s -o - | FileCheck %s 3 4... 5--- 6name: ssubo_s32 7alignment: 4 8legalized: true 9regBankSelected: true 10tracksRegLiveness: true 11body: | 12 bb.1.entry: 13 liveins: $w0, $w1, $x2 14 15 ; CHECK-LABEL: name: ssubo_s32 16 ; CHECK: liveins: $w0, $w1, $x2 17 ; CHECK: %reg0:gpr32 = COPY $w0 18 ; CHECK: %reg1:gpr32 = COPY $w1 19 ; CHECK: %ssubo:gpr32 = SUBSWrr %reg0, %reg1, implicit-def $nzcv 20 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 7, implicit $nzcv 21 ; CHECK: $w0 = COPY %ssubo 22 ; CHECK: RET_ReallyLR implicit $w0 23 %reg0:gpr(s32) = COPY $w0 24 %reg1:gpr(s32) = COPY $w1 25 %ssubo:gpr(s32), %4:gpr(s1) = G_SSUBO %reg0, %reg1 26 $w0 = COPY %ssubo(s32) 27 RET_ReallyLR implicit $w0 28 29... 30--- 31name: ssubo_s64 32alignment: 4 33legalized: true 34regBankSelected: true 35tracksRegLiveness: true 36body: | 37 bb.1.entry: 38 liveins: $x0, $x1, $x2 39 40 ; CHECK-LABEL: name: ssubo_s64 41 ; CHECK: liveins: $x0, $x1, $x2 42 ; CHECK: %reg0:gpr64 = COPY $x0 43 ; CHECK: %reg1:gpr64 = COPY $x1 44 ; CHECK: %ssubo:gpr64 = SUBSXrr %reg0, %reg1, implicit-def $nzcv 45 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 7, implicit $nzcv 46 ; CHECK: $x0 = COPY %ssubo 47 ; CHECK: RET_ReallyLR implicit $x0 48 %reg0:gpr(s64) = COPY $x0 49 %reg1:gpr(s64) = COPY $x1 50 %ssubo:gpr(s64), %4:gpr(s1) = G_SSUBO %reg0, %reg1 51 $x0 = COPY %ssubo(s64) 52 RET_ReallyLR implicit $x0 53 54... 55--- 56name: ssubo_s32_imm 57alignment: 4 58legalized: true 59regBankSelected: true 60tracksRegLiveness: true 61body: | 62 bb.1.entry: 63 liveins: $w0, $w1, $x2 64 ; Check that we get SUBSWri when we can fold in a constant. 65 ; 66 ; CHECK-LABEL: name: ssubo_s32_imm 67 ; CHECK: liveins: $w0, $w1, $x2 68 ; CHECK: %copy:gpr32sp = COPY $w0 69 ; CHECK: %ssubo:gpr32 = SUBSWri %copy, 16, 0, implicit-def $nzcv 70 ; CHECK: %overflow:gpr32 = CSINCWr $wzr, $wzr, 7, implicit $nzcv 71 ; CHECK: $w0 = COPY %ssubo 72 ; CHECK: RET_ReallyLR implicit $w0 73 %copy:gpr(s32) = COPY $w0 74 %constant:gpr(s32) = G_CONSTANT i32 16 75 %ssubo:gpr(s32), %overflow:gpr(s1) = G_SSUBO %copy, %constant 76 $w0 = COPY %ssubo(s32) 77 RET_ReallyLR implicit $w0 78 79... 80--- 81name: ssubo_s32_shifted 82alignment: 4 83legalized: true 84regBankSelected: true 85tracksRegLiveness: true 86body: | 87 bb.1.entry: 88 liveins: $w0, $w1, $x2 89 ; Check that we get SUBSWrs when we can fold in a shift. 90 ; 91 ; CHECK-LABEL: name: ssubo_s32_shifted 92 ; CHECK: liveins: $w0, $w1, $x2 93 ; CHECK: %reg0:gpr32 = COPY $w0 94 ; CHECK: %reg1:gpr32 = COPY $w1 95 ; CHECK: %sub:gpr32 = SUBSWrs %reg0, %reg1, 16, implicit-def $nzcv 96 ; CHECK: %overflow:gpr32 = CSINCWr $wzr, $wzr, 7, implicit $nzcv 97 ; CHECK: $w0 = COPY %sub 98 ; CHECK: RET_ReallyLR implicit $w0 99 %reg0:gpr(s32) = COPY $w0 100 %reg1:gpr(s32) = COPY $w1 101 %constant:gpr(s32) = G_CONSTANT i32 16 102 %shift:gpr(s32) = G_SHL %reg1(s32), %constant(s32) 103 %sub:gpr(s32), %overflow:gpr(s1) = G_SSUBO %reg0, %shift 104 $w0 = COPY %sub(s32) 105 RET_ReallyLR implicit $w0 106 107... 108--- 109name: ssubo_s32_neg_imm 110alignment: 4 111legalized: true 112regBankSelected: true 113tracksRegLiveness: true 114body: | 115 bb.1.entry: 116 liveins: $w0, $w1, $x2 117 ; Check that we get ADDSWri when we can fold in a negative constant. 118 ; 119 ; CHECK-LABEL: name: ssubo_s32_neg_imm 120 ; CHECK: liveins: $w0, $w1, $x2 121 ; CHECK: %copy:gpr32sp = COPY $w0 122 ; CHECK: %sub:gpr32 = ADDSWri %copy, 16, 0, implicit-def $nzcv 123 ; CHECK: %overflow:gpr32 = CSINCWr $wzr, $wzr, 7, implicit $nzcv 124 ; CHECK: $w0 = COPY %sub 125 ; CHECK: RET_ReallyLR implicit $w0 126 %copy:gpr(s32) = COPY $w0 127 %constant:gpr(s32) = G_CONSTANT i32 -16 128 %sub:gpr(s32), %overflow:gpr(s1) = G_SSUBO %copy, %constant 129 $w0 = COPY %sub(s32) 130 RET_ReallyLR implicit $w0 131 132... 133--- 134name: ssubo_arith_extended 135alignment: 4 136legalized: true 137regBankSelected: true 138tracksRegLiveness: true 139body: | 140 bb.1.entry: 141 liveins: $w0, $x0 142 ; Check that we get SUBSXrx. 143 ; CHECK-LABEL: name: ssubo_arith_extended 144 ; CHECK: liveins: $w0, $x0 145 ; CHECK: %reg0:gpr64sp = COPY $x0 146 ; CHECK: %reg1:gpr32 = COPY $w0 147 ; CHECK: %sub:gpr64 = SUBSXrx %reg0, %reg1, 18, implicit-def $nzcv 148 ; CHECK: %flags:gpr32 = CSINCWr $wzr, $wzr, 7, implicit $nzcv 149 ; CHECK: $x0 = COPY %sub 150 ; CHECK: RET_ReallyLR implicit $x0 151 %reg0:gpr(s64) = COPY $x0 152 %reg1:gpr(s32) = COPY $w0 153 %ext:gpr(s64) = G_ZEXT %reg1(s32) 154 %cst:gpr(s64) = G_CONSTANT i64 2 155 %shift:gpr(s64) = G_SHL %ext, %cst(s64) 156 %sub:gpr(s64), %flags:gpr(s1) = G_SSUBO %reg0, %shift 157 $x0 = COPY %sub(s64) 158 RET_ReallyLR implicit $x0 159