1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -fast-isel=0 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ISEL
3 ; RUN: llc -mtriple=aarch64-linux-gnu -fast-isel=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,FAST
5 define i32 @test1(i32 %x) {
8 ; CHECK-NEXT: add w8, w0, #7
9 ; CHECK-NEXT: cmp w0, #0
10 ; CHECK-NEXT: csel w8, w8, w0, lt
11 ; CHECK-NEXT: asr w0, w8, #3
17 define i32 @test2(i32 %x) {
20 ; CHECK-NEXT: add w8, w0, #7
21 ; CHECK-NEXT: cmp w0, #0
22 ; CHECK-NEXT: csel w8, w8, w0, lt
23 ; CHECK-NEXT: neg w0, w8, asr #3
25 %div = sdiv i32 %x, -8
29 define i32 @test3(i32 %x) {
32 ; CHECK-NEXT: add w8, w0, #31
33 ; CHECK-NEXT: cmp w0, #0
34 ; CHECK-NEXT: csel w8, w8, w0, lt
35 ; CHECK-NEXT: asr w0, w8, #5
37 %div = sdiv i32 %x, 32
41 define i64 @test4(i64 %x) {
44 ; CHECK-NEXT: add x8, x0, #7
45 ; CHECK-NEXT: cmp x0, #0
46 ; CHECK-NEXT: csel x8, x8, x0, lt
47 ; CHECK-NEXT: asr x0, x8, #3
53 define i64 @test5(i64 %x) {
56 ; CHECK-NEXT: add x8, x0, #7
57 ; CHECK-NEXT: cmp x0, #0
58 ; CHECK-NEXT: csel x8, x8, x0, lt
59 ; CHECK-NEXT: neg x0, x8, asr #3
61 %div = sdiv i64 %x, -8
65 define i64 @test6(i64 %x) {
68 ; CHECK-NEXT: add x8, x0, #63
69 ; CHECK-NEXT: cmp x0, #0
70 ; CHECK-NEXT: csel x8, x8, x0, lt
71 ; CHECK-NEXT: asr x0, x8, #6
73 %div = sdiv i64 %x, 64
77 define i64 @test7(i64 %x) {
80 ; CHECK-NEXT: mov x8, #281474976710655
81 ; CHECK-NEXT: cmp x0, #0
82 ; CHECK-NEXT: add x8, x0, x8
83 ; CHECK-NEXT: csel x8, x8, x0, lt
84 ; CHECK-NEXT: asr x0, x8, #48
86 %div = sdiv i64 %x, 281474976710656
90 define i64 @test8(i64 %x) {
93 ; ISEL-NEXT: cmp x0, #0
94 ; ISEL-NEXT: cinc x8, x0, lt
95 ; ISEL-NEXT: asr x0, x8, #1
100 ; FAST-NEXT: add x8, x0, #1
101 ; FAST-NEXT: cmp x0, #0
102 ; FAST-NEXT: csel x8, x8, x0, lt
103 ; FAST-NEXT: asr x0, x8, #1
105 %div = sdiv i64 %x, 2