1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=aarch64 -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SD
; RUN: llc -mtriple=aarch64 -global-isel -global-isel-abort=2 -o - %s 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
; CHECK-GI: warning: Instruction selection used fallback path for test_umul_i128
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for test_smul_i128
define i128 @test_uadd_i128(i128 noundef %x, i128 noundef %y) {
; CHECK-SD-LABEL: test_uadd_i128:
; CHECK-SD: // %bb.0: // %entry
; CHECK-SD-NEXT: adds x0, x0, x2
; CHECK-SD-NEXT: adcs x1, x1, x3
; CHECK-SD-NEXT: b.lo .LBB0_2
; CHECK-SD-NEXT: // %bb.1: // %if.then
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-SD-NEXT: .cfi_def_cfa_offset 16
; CHECK-SD-NEXT: .cfi_offset w30, -16
; CHECK-SD-NEXT: bl error
; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-SD-NEXT: sxtw x0, w0
; CHECK-SD-NEXT: asr x1, x0, #63
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-SD-NEXT: .LBB0_2: // %cleanup
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: test_uadd_i128:
; CHECK-GI: // %bb.0: // %entry
; CHECK-GI-NEXT: adds x0, x0, x2
; CHECK-GI-NEXT: adcs x1, x1, x3
; CHECK-GI-NEXT: b.lo .LBB0_2
; CHECK-GI-NEXT: // %bb.1: // %if.then
; CHECK-GI-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-GI-NEXT: .cfi_def_cfa_offset 16
; CHECK-GI-NEXT: .cfi_offset w30, -16
; CHECK-GI-NEXT: bl error
; CHECK-GI-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-GI-NEXT: asr w1, w0, #31
; CHECK-GI-NEXT: bfi x0, x1, #32, #32
; CHECK-GI-NEXT: bfi x1, x1, #32, #32
; CHECK-GI-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-GI-NEXT: .LBB0_2: // %cleanup
; CHECK-GI-NEXT: ret
entry:
%0 = tail call { i128, i1 } @llvm.uadd.with.overflow.i128(i128 %x, i128 %y)
%1 = extractvalue { i128, i1 } %0, 1
br i1 %1, label %if.then, label %if.end
if.then:
%call = tail call i32 @error()
%conv1 = sext i32 %call to i128
br label %cleanup
if.end:
%2 = extractvalue { i128, i1 } %0, 0
br label %cleanup
cleanup:
%retval.0 = phi i128 [ %conv1, %if.then ], [ %2, %if.end ]
ret i128 %retval.0
}
define i128 @test_sadd_i128(i128 noundef %x, i128 noundef %y) {
; CHECK-SD-LABEL: test_sadd_i128:
; CHECK-SD: // %bb.0: // %entry
; CHECK-SD-NEXT: adds x0, x0, x2
; CHECK-SD-NEXT: adcs x1, x1, x3
; CHECK-SD-NEXT: b.vc .LBB1_2
; CHECK-SD-NEXT: // %bb.1: // %if.then
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-SD-NEXT: .cfi_def_cfa_offset 16
; CHECK-SD-NEXT: .cfi_offset w30, -16
; CHECK-SD-NEXT: bl error
; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-SD-NEXT: sxtw x0, w0
; CHECK-SD-NEXT: asr x1, x0, #63
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-SD-NEXT: .LBB1_2: // %cleanup
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: test_sadd_i128:
; CHECK-GI: // %bb.0: // %entry
; CHECK-GI-NEXT: adds x0, x0, x2
; CHECK-GI-NEXT: adcs x1, x1, x3
; CHECK-GI-NEXT: b.vc .LBB1_2
; CHECK-GI-NEXT: // %bb.1: // %if.then
; CHECK-GI-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-GI-NEXT: .cfi_def_cfa_offset 16
; CHECK-GI-NEXT: .cfi_offset w30, -16
; CHECK-GI-NEXT: bl error
; CHECK-GI-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-GI-NEXT: asr w1, w0, #31
; CHECK-GI-NEXT: bfi x0, x1, #32, #32
; CHECK-GI-NEXT: bfi x1, x1, #32, #32
; CHECK-GI-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-GI-NEXT: .LBB1_2: // %cleanup
; CHECK-GI-NEXT: ret
entry:
%0 = tail call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %x, i128 %y)
%1 = extractvalue { i128, i1 } %0, 1
br i1 %1, label %if.then, label %if.end
if.then:
%call = tail call i32 @error()
%conv1 = sext i32 %call to i128
br label %cleanup
if.end:
%2 = extractvalue { i128, i1 } %0, 0
br label %cleanup
cleanup:
%retval.0 = phi i128 [ %conv1, %if.then ], [ %2, %if.end ]
ret i128 %retval.0
}
define i128 @test_usub_i128(i128 noundef %x, i128 noundef %y) {
; CHECK-SD-LABEL: test_usub_i128:
; CHECK-SD: // %bb.0: // %entry
; CHECK-SD-NEXT: subs x0, x0, x2
; CHECK-SD-NEXT: sbcs x1, x1, x3
; CHECK-SD-NEXT: b.hs .LBB2_2
; CHECK-SD-NEXT: // %bb.1: // %if.then
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-SD-NEXT: .cfi_def_cfa_offset 16
; CHECK-SD-NEXT: .cfi_offset w30, -16
; CHECK-SD-NEXT: bl error
; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-SD-NEXT: sxtw x0, w0
; CHECK-SD-NEXT: asr x1, x0, #63
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-SD-NEXT: .LBB2_2: // %cleanup
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: test_usub_i128:
; CHECK-GI: // %bb.0: // %entry
; CHECK-GI-NEXT: subs x0, x0, x2
; CHECK-GI-NEXT: sbcs x1, x1, x3
; CHECK-GI-NEXT: b.hs .LBB2_2
; CHECK-GI-NEXT: // %bb.1: // %if.then
; CHECK-GI-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-GI-NEXT: .cfi_def_cfa_offset 16
; CHECK-GI-NEXT: .cfi_offset w30, -16
; CHECK-GI-NEXT: bl error
; CHECK-GI-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-GI-NEXT: asr w1, w0, #31
; CHECK-GI-NEXT: bfi x0, x1, #32, #32
; CHECK-GI-NEXT: bfi x1, x1, #32, #32
; CHECK-GI-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-GI-NEXT: .LBB2_2: // %cleanup
; CHECK-GI-NEXT: ret
entry:
%0 = tail call { i128, i1 } @llvm.usub.with.overflow.i128(i128 %x, i128 %y)
%1 = extractvalue { i128, i1 } %0, 1
br i1 %1, label %if.then, label %if.end
if.then:
%call = tail call i32 @error()
%conv1 = sext i32 %call to i128
br label %cleanup
if.end:
%2 = extractvalue { i128, i1 } %0, 0
br label %cleanup
cleanup:
%retval.0 = phi i128 [ %conv1, %if.then ], [ %2, %if.end ]
ret i128 %retval.0
}
define i128 @test_ssub_i128(i128 noundef %x, i128 noundef %y) {
; CHECK-SD-LABEL: test_ssub_i128:
; CHECK-SD: // %bb.0: // %entry
; CHECK-SD-NEXT: subs x0, x0, x2
; CHECK-SD-NEXT: sbcs x1, x1, x3
; CHECK-SD-NEXT: b.vc .LBB3_2
; CHECK-SD-NEXT: // %bb.1: // %if.then
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-SD-NEXT: .cfi_def_cfa_offset 16
; CHECK-SD-NEXT: .cfi_offset w30, -16
; CHECK-SD-NEXT: bl error
; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-SD-NEXT: sxtw x0, w0
; CHECK-SD-NEXT: asr x1, x0, #63
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-SD-NEXT: .LBB3_2: // %cleanup
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: test_ssub_i128:
; CHECK-GI: // %bb.0: // %entry
; CHECK-GI-NEXT: subs x0, x0, x2
; CHECK-GI-NEXT: sbcs x1, x1, x3
; CHECK-GI-NEXT: b.vc .LBB3_2
; CHECK-GI-NEXT: // %bb.1: // %if.then
; CHECK-GI-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-GI-NEXT: .cfi_def_cfa_offset 16
; CHECK-GI-NEXT: .cfi_offset w30, -16
; CHECK-GI-NEXT: bl error
; CHECK-GI-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-GI-NEXT: asr w1, w0, #31
; CHECK-GI-NEXT: bfi x0, x1, #32, #32
; CHECK-GI-NEXT: bfi x1, x1, #32, #32
; CHECK-GI-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-GI-NEXT: .LBB3_2: // %cleanup
; CHECK-GI-NEXT: ret
entry:
%0 = tail call { i128, i1 } @llvm.ssub.with.overflow.i128(i128 %x, i128 %y)
%1 = extractvalue { i128, i1 } %0, 1
br i1 %1, label %if.then, label %if.end
if.then:
%call = tail call i32 @error()
%conv1 = sext i32 %call to i128
br label %cleanup
if.end:
%2 = extractvalue { i128, i1 } %0, 0
br label %cleanup
cleanup:
%retval.0 = phi i128 [ %conv1, %if.then ], [ %2, %if.end ]
ret i128 %retval.0
}
define i128 @test_umul_i128(i128 noundef %x, i128 noundef %y) {
; CHECK-LABEL: test_umul_i128:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: mul x9, x3, x0
; CHECK-NEXT: cmp x1, #0
; CHECK-NEXT: ccmp x3, #0, #4, ne
; CHECK-NEXT: umulh x8, x1, x2
; CHECK-NEXT: umulh x10, x3, x0
; CHECK-NEXT: madd x9, x1, x2, x9
; CHECK-NEXT: ccmp xzr, x8, #0, eq
; CHECK-NEXT: umulh x11, x0, x2
; CHECK-NEXT: ccmp xzr, x10, #0, eq
; CHECK-NEXT: cset w8, ne
; CHECK-NEXT: adds x1, x11, x9
; CHECK-NEXT: csinc w8, w8, wzr, lo
; CHECK-NEXT: cmp w8, #1
; CHECK-NEXT: b.ne .LBB4_2
; CHECK-NEXT: // %bb.1: // %if.then
; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset w30, -16
; CHECK-NEXT: bl error
; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-NEXT: sxtw x0, w0
; CHECK-NEXT: asr x1, x0, #63
; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-NEXT: ret
; CHECK-NEXT: .LBB4_2: // %if.end
; CHECK-NEXT: mul x0, x0, x2
; CHECK-NEXT: ret
entry:
%0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %x, i128 %y)
%1 = extractvalue { i128, i1 } %0, 1
br i1 %1, label %if.then, label %if.end
if.then:
%call = tail call i32 @error()
%conv1 = sext i32 %call to i128
br label %cleanup
if.end:
%2 = extractvalue { i128, i1 } %0, 0
br label %cleanup
cleanup:
%retval.0 = phi i128 [ %conv1, %if.then ], [ %2, %if.end ]
ret i128 %retval.0
}
define i128 @test_smul_i128(i128 noundef %x, i128 noundef %y) {
; CHECK-LABEL: test_smul_i128:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: asr x10, x1, #63
; CHECK-NEXT: umulh x11, x0, x2
; CHECK-NEXT: asr x14, x3, #63
; CHECK-NEXT: mov x8, x1
; CHECK-NEXT: mul x12, x1, x2
; CHECK-NEXT: umulh x9, x1, x2
; CHECK-NEXT: mul x10, x10, x2
; CHECK-NEXT: adds x11, x12, x11
; CHECK-NEXT: mul x15, x0, x3
; CHECK-NEXT: umulh x13, x0, x3
; CHECK-NEXT: adc x9, x9, x10
; CHECK-NEXT: mul x14, x0, x14
; CHECK-NEXT: mul x16, x1, x3
; CHECK-NEXT: adds x1, x15, x11
; CHECK-NEXT: asr x11, x9, #63
; CHECK-NEXT: smulh x8, x8, x3
; CHECK-NEXT: adc x10, x13, x14
; CHECK-NEXT: asr x12, x10, #63
; CHECK-NEXT: adds x9, x9, x10
; CHECK-NEXT: adc x10, x11, x12
; CHECK-NEXT: adds x9, x16, x9
; CHECK-NEXT: asr x11, x1, #63
; CHECK-NEXT: adc x8, x8, x10
; CHECK-NEXT: eor x8, x8, x11
; CHECK-NEXT: eor x9, x9, x11
; CHECK-NEXT: orr x8, x9, x8
; CHECK-NEXT: cbz x8, .LBB5_2
; CHECK-NEXT: // %bb.1: // %if.then
; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset w30, -16
; CHECK-NEXT: bl error
; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-NEXT: sxtw x0, w0
; CHECK-NEXT: asr x1, x0, #63
; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-NEXT: ret
; CHECK-NEXT: .LBB5_2: // %if.end
; CHECK-NEXT: mul x0, x0, x2
; CHECK-NEXT: ret
entry:
%0 = tail call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %x, i128 %y)
%1 = extractvalue { i128, i1 } %0, 1
br i1 %1, label %if.then, label %if.end
if.then:
%call = tail call i32 @error()
%conv1 = sext i32 %call to i128
br label %cleanup
if.end:
%2 = extractvalue { i128, i1 } %0, 0
br label %cleanup
cleanup:
%retval.0 = phi i128 [ %conv1, %if.then ], [ %2, %if.end ]
ret i128 %retval.0
}
declare i32 @error()
|