1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
4 ; On AArch64, division in expensive. BuildRemEqFold should therefore run even
5 ; when optimizing for size. Only optimizing for minimum size retains a plain div.
7 define i32 @test_minsize(i32 %X) optsize minsize nounwind readnone {
8 ; CHECK-LABEL: test_minsize:
10 ; CHECK-NEXT: mov w8, #5
11 ; CHECK-NEXT: udiv w8, w0, w8
12 ; CHECK-NEXT: add w8, w8, w8, lsl #2
13 ; CHECK-NEXT: mov w9, #-10
14 ; CHECK-NEXT: cmp w0, w8
15 ; CHECK-NEXT: mov w8, #42
16 ; CHECK-NEXT: csel w0, w8, w9, eq
19 %cmp = icmp eq i32 %rem, 0
20 %ret = select i1 %cmp, i32 42, i32 -10
24 define i32 @test_optsize(i32 %X) optsize nounwind readnone {
25 ; CHECK-LABEL: test_optsize:
27 ; CHECK-NEXT: mov w8, #52429
28 ; CHECK-NEXT: movk w8, #52428, lsl #16
29 ; CHECK-NEXT: mov w9, #13108
30 ; CHECK-NEXT: movk w9, #13107, lsl #16
31 ; CHECK-NEXT: mul w8, w0, w8
32 ; CHECK-NEXT: mov w10, #-10
33 ; CHECK-NEXT: cmp w8, w9
34 ; CHECK-NEXT: mov w8, #42
35 ; CHECK-NEXT: csel w0, w8, w10, lo
38 %cmp = icmp eq i32 %rem, 0
39 %ret = select i1 %cmp, i32 42, i32 -10