1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -march=hexagon < %s | FileCheck %s
4 ; Check if we generate rounding-asr instruction. It is equivalent to
5 ; Rd = ((Rs >> #u) +1) >> 1.
7 target triple = "hexagon"
9 define i32 @f0(i32 %a0) {
11 ; CHECK: .cfi_startproc
12 ; CHECK-NEXT: // %bb.0: // %b0
14 ; CHECK-NEXT: r0 = asr(r0,#10):rnd
16 ; CHECK-NEXT: r29 = add(r29,#-8)
19 ; CHECK-NEXT: r29 = add(r29,#8)
20 ; CHECK-NEXT: jumpr r31
21 ; CHECK-NEXT: memw(r29+#4) = r1
24 %v0 = alloca i32, align 4
25 store i32 %a0, ptr %v0, align 4
26 %v1 = load i32, ptr %v0, align 4
27 %v2 = ashr i32 %v1, 10
28 %v3 = add nsw i32 %v2, 1
33 define i64 @f1(i64 %a0) {
35 ; CHECK: .cfi_startproc
36 ; CHECK-NEXT: // %bb.0: // %b0
38 ; CHECK-NEXT: r1:0 = asr(r1:0,#17):rnd
39 ; CHECK-NEXT: r3:2 = combine(r1,r0)
40 ; CHECK-NEXT: r29 = add(r29,#-8)
43 ; CHECK-NEXT: r29 = add(r29,#8)
44 ; CHECK-NEXT: jumpr r31
45 ; CHECK-NEXT: memd(r29+#0) = r3:2
48 %v0 = alloca i64, align 8
49 store i64 %a0, ptr %v0, align 8
50 %v1 = load i64, ptr %v0, align 8
51 %v2 = ashr i64 %v1, 17
52 %v3 = add nsw i64 %v2, 1