1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < %s | FileCheck -check-prefix=RV32IF %s
3 ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s | FileCheck -check-prefix=RV64IF %s
5 define i32 @func_01() {
6 ; RV32IF-LABEL: func_01:
9 ; RV32IF-NEXT: slli a0, a0, 2
10 ; RV32IF-NEXT: lui a1, 66
11 ; RV32IF-NEXT: addi a1, a1, 769
12 ; RV32IF-NEXT: srl a0, a1, a0
13 ; RV32IF-NEXT: andi a0, a0, 7
16 ; RV64IF-LABEL: func_01:
18 ; RV64IF-NEXT: frrm a0
19 ; RV64IF-NEXT: slli a0, a0, 2
20 ; RV64IF-NEXT: lui a1, 66
21 ; RV64IF-NEXT: addiw a1, a1, 769
22 ; RV64IF-NEXT: srl a0, a1, a0
23 ; RV64IF-NEXT: andi a0, a0, 7
25 %rm = call i32 @llvm.get.rounding()
29 define void @func_02(i32 %rm) {
30 ; RV32IF-LABEL: func_02:
32 ; RV32IF-NEXT: slli a0, a0, 2
33 ; RV32IF-NEXT: lui a1, 66
34 ; RV32IF-NEXT: addi a1, a1, 769
35 ; RV32IF-NEXT: srl a0, a1, a0
36 ; RV32IF-NEXT: andi a0, a0, 7
37 ; RV32IF-NEXT: fsrm a0
40 ; RV64IF-LABEL: func_02:
42 ; RV64IF-NEXT: slli a0, a0, 32
43 ; RV64IF-NEXT: srli a0, a0, 30
44 ; RV64IF-NEXT: lui a1, 66
45 ; RV64IF-NEXT: addiw a1, a1, 769
46 ; RV64IF-NEXT: srl a0, a1, a0
47 ; RV64IF-NEXT: andi a0, a0, 7
48 ; RV64IF-NEXT: fsrm a0
50 call void @llvm.set.rounding(i32 %rm)
54 define void @func_03() {
55 ; RV32IF-LABEL: func_03:
57 ; RV32IF-NEXT: fsrmi 1
60 ; RV64IF-LABEL: func_03:
62 ; RV64IF-NEXT: fsrmi 1
64 call void @llvm.set.rounding(i32 0)
68 define void @func_04() {
69 ; RV32IF-LABEL: func_04:
71 ; RV32IF-NEXT: fsrmi 0
74 ; RV64IF-LABEL: func_04:
76 ; RV64IF-NEXT: fsrmi 0
78 call void @llvm.set.rounding(i32 1)
82 define void @func_05() {
83 ; RV32IF-LABEL: func_05:
85 ; RV32IF-NEXT: fsrmi 3
88 ; RV64IF-LABEL: func_05:
90 ; RV64IF-NEXT: fsrmi 3
92 call void @llvm.set.rounding(i32 2)
96 define void @func_06() {
97 ; RV32IF-LABEL: func_06:
99 ; RV32IF-NEXT: fsrmi 2
102 ; RV64IF-LABEL: func_06:
104 ; RV64IF-NEXT: fsrmi 2
106 call void @llvm.set.rounding(i32 3)
110 define void @func_07() {
111 ; RV32IF-LABEL: func_07:
113 ; RV32IF-NEXT: fsrmi 4
116 ; RV64IF-LABEL: func_07:
118 ; RV64IF-NEXT: fsrmi 4
120 call void @llvm.set.rounding(i32 4)
124 declare void @llvm.set.rounding(i32)
125 declare i32 @llvm.get.rounding()