1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 ; Check if we generate rounding-asr instruction. It is equivalent to
4 ; Rd = ((Rs >> #u) +1) >> 1.
5 target triple = "hexagon"
7 ; Function Attrs: nounwind
8 define i32 @f0(i32 %a0) #0 {
10 ; CHECK: asr{{.*}}:rnd
11 %v0 = alloca i32, align 4
12 store i32 %a0, ptr %v0, align 4
13 %v1 = load i32, ptr %v0, align 4
14 %v2 = ashr i32 %v1, 10
15 %v3 = add nsw i32 %v2, 1
20 ; Function Attrs: nounwind
21 define i64 @f1(i64 %a0) #0 {
23 ; CHECK: asr{{.*}}:rnd
24 %v0 = alloca i64, align 8
25 store i64 %a0, ptr %v0, align 8
26 %v1 = load i64, ptr %v0, align 8
27 %v2 = ashr i64 %v1, 17
28 %v3 = add nsw i64 %v2, 1
33 attributes #0 = { nounwind }