1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ISEL
3 ; RUN: llc -mtriple=aarch64-linux-gnu -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,FAST
5 define i32 @sdiv_i32_exact(i32 %a) {
6 ; CHECK-LABEL: sdiv_i32_exact:
8 ; CHECK-NEXT: asr w0, w0, #3
10 %1 = sdiv exact i32 %a, 8
14 define i32 @sdiv_i32_pos(i32 %a) {
15 ; CHECK-LABEL: sdiv_i32_pos:
17 ; CHECK-NEXT: add w8, w0, #7 // =7
18 ; CHECK-NEXT: cmp w0, #0 // =0
19 ; CHECK-NEXT: csel w8, w8, w0, lt
20 ; CHECK-NEXT: asr w0, w8, #3
26 define i32 @sdiv_i32_neg(i32 %a) {
27 ; CHECK-LABEL: sdiv_i32_neg:
29 ; CHECK-NEXT: add w8, w0, #7 // =7
30 ; CHECK-NEXT: cmp w0, #0 // =0
31 ; CHECK-NEXT: csel w8, w8, w0, lt
32 ; CHECK-NEXT: neg w0, w8, asr #3
38 define i64 @sdiv_i64_exact(i64 %a) {
39 ; CHECK-LABEL: sdiv_i64_exact:
41 ; CHECK-NEXT: asr x0, x0, #4
43 %1 = sdiv exact i64 %a, 16
47 define i64 @sdiv_i64_pos(i64 %a) {
48 ; CHECK-LABEL: sdiv_i64_pos:
50 ; CHECK-NEXT: add x8, x0, #15 // =15
51 ; CHECK-NEXT: cmp x0, #0 // =0
52 ; CHECK-NEXT: csel x8, x8, x0, lt
53 ; CHECK-NEXT: asr x0, x8, #4
59 define i64 @sdiv_i64_neg(i64 %a) {
60 ; CHECK-LABEL: sdiv_i64_neg:
62 ; CHECK-NEXT: add x8, x0, #15 // =15
63 ; CHECK-NEXT: cmp x0, #0 // =0
64 ; CHECK-NEXT: csel x8, x8, x0, lt
65 ; CHECK-NEXT: neg x0, x8, asr #4