[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / RISCV / rv32zfh-valid.s
blobf257ad0d91feadecf284ececbe47ecd8c2ca8b80
1 # RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-zfh -riscv-no-aliases -show-encoding \
2 # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
3 # RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zfh -riscv-no-aliases -show-encoding \
4 # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
5 # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zfh < %s \
6 # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \
7 # RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
8 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zfh < %s \
9 # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \
10 # RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
12 # CHECK-ASM-AND-OBJ: flh ft0, 12(a0)
13 # CHECK-ASM: encoding: [0x07,0x10,0xc5,0x00]
14 flh f0, 12(a0)
15 # CHECK-ASM-AND-OBJ: flh ft1, 4(ra)
16 # CHECK-ASM: encoding: [0x87,0x90,0x40,0x00]
17 flh f1, +4(ra)
18 # CHECK-ASM-AND-OBJ: flh ft2, -2048(a3)
19 # CHECK-ASM: encoding: [0x07,0x91,0x06,0x80]
20 flh f2, -2048(x13)
21 # CHECK-ASM-AND-OBJ: flh ft3, -2048(s1)
22 # CHECK-ASM: encoding: [0x87,0x91,0x04,0x80]
23 flh f3, %lo(2048)(s1)
24 # CHECK-ASM-AND-OBJ: flh ft4, 2047(s2)
25 # CHECK-ASM: encoding: [0x07,0x12,0xf9,0x7f]
26 flh f4, 2047(s2)
27 # CHECK-ASM-AND-OBJ: flh ft5, 0(s3)
28 # CHECK-ASM: encoding: [0x87,0x92,0x09,0x00]
29 flh f5, 0(s3)
31 # CHECK-ASM-AND-OBJ: fsh ft6, 2047(s4)
32 # CHECK-ASM: encoding: [0xa7,0x1f,0x6a,0x7e]
33 fsh f6, 2047(s4)
34 # CHECK-ASM-AND-OBJ: fsh ft7, -2048(s5)
35 # CHECK-ASM: encoding: [0x27,0x90,0x7a,0x80]
36 fsh f7, -2048(s5)
37 # CHECK-ASM-AND-OBJ: fsh fs0, -2048(s6)
38 # CHECK-ASM: encoding: [0x27,0x10,0x8b,0x80]
39 fsh f8, %lo(2048)(s6)
40 # CHECK-ASM-AND-OBJ: fsh fs1, 999(s7)
41 # CHECK-ASM: encoding: [0xa7,0x93,0x9b,0x3e]
42 fsh f9, 999(s7)
44 # CHECK-ASM-AND-OBJ: fmadd.h fa0, fa1, fa2, fa3, dyn
45 # CHECK-ASM: encoding: [0x43,0xf5,0xc5,0x6c]
46 fmadd.h f10, f11, f12, f13, dyn
47 # CHECK-ASM-AND-OBJ: fmsub.h fa4, fa5, fa6, fa7, dyn
48 # CHECK-ASM: encoding: [0x47,0xf7,0x07,0x8d]
49 fmsub.h f14, f15, f16, f17, dyn
50 # CHECK-ASM-AND-OBJ: fnmsub.h fs2, fs3, fs4, fs5, dyn
51 # CHECK-ASM: encoding: [0x4b,0xf9,0x49,0xad]
52 fnmsub.h f18, f19, f20, f21, dyn
53 # CHECK-ASM-AND-OBJ: fnmadd.h fs6, fs7, fs8, fs9, dyn
54 # CHECK-ASM: encoding: [0x4f,0xfb,0x8b,0xcd]
55 fnmadd.h f22, f23, f24, f25, dyn
57 # CHECK-ASM-AND-OBJ: fadd.h fs10, fs11, ft8, dyn
58 # CHECK-ASM: encoding: [0x53,0xfd,0xcd,0x05]
59 fadd.h f26, f27, f28, dyn
60 # CHECK-ASM-AND-OBJ: fsub.h ft9, ft10, ft11, dyn
61 # CHECK-ASM: encoding: [0xd3,0x7e,0xff,0x0d]
62 fsub.h f29, f30, f31, dyn
63 # CHECK-ASM-AND-OBJ: fmul.h ft0, ft1, ft2, dyn
64 # CHECK-ASM: encoding: [0x53,0xf0,0x20,0x14]
65 fmul.h ft0, ft1, ft2, dyn
66 # CHECK-ASM-AND-OBJ: fdiv.h ft3, ft4, ft5, dyn
67 # CHECK-ASM: encoding: [0xd3,0x71,0x52,0x1c]
68 fdiv.h ft3, ft4, ft5, dyn
69 # CHECK-ASM-AND-OBJ: fsqrt.h ft6, ft7, dyn
70 # CHECK-ASM: encoding: [0x53,0xf3,0x03,0x5c]
71 fsqrt.h ft6, ft7, dyn
72 # CHECK-ASM-AND-OBJ: fsgnj.h fs1, fa0, fa1
73 # CHECK-ASM: encoding: [0xd3,0x04,0xb5,0x24]
74 fsgnj.h fs1, fa0, fa1
75 # CHECK-ASM-AND-OBJ: fsgnjn.h fa1, fa3, fa4
76 # CHECK-ASM: encoding: [0xd3,0x95,0xe6,0x24]
77 fsgnjn.h fa1, fa3, fa4
78 # CHECK-ASM-AND-OBJ: fsgnjx.h fa4, fa3, fa2
79 # CHECK-ASM: encoding: [0x53,0xa7,0xc6,0x24]
80 fsgnjx.h fa4, fa3, fa2
81 # CHECK-ASM-AND-OBJ: fmin.h fa5, fa6, fa7
82 # CHECK-ASM: encoding: [0xd3,0x07,0x18,0x2d]
83 fmin.h fa5, fa6, fa7
84 # CHECK-ASM-AND-OBJ: fmax.h fs2, fs3, fs4
85 # CHECK-ASM: encoding: [0x53,0x99,0x49,0x2d]
86 fmax.h fs2, fs3, fs4
87 # CHECK-ASM-AND-OBJ: fcvt.w.h a0, fs5, dyn
88 # CHECK-ASM: encoding: [0x53,0xf5,0x0a,0xc4]
89 fcvt.w.h a0, fs5, dyn
90 # CHECK-ASM-AND-OBJ: fcvt.wu.h a1, fs6, dyn
91 # CHECK-ASM: encoding: [0xd3,0x75,0x1b,0xc4]
92 fcvt.wu.h a1, fs6, dyn
93 # CHECK-ASM-AND-OBJ: fmv.x.h a2, fs7
94 # CHECK-ASM: encoding: [0x53,0x86,0x0b,0xe4]
95 fmv.x.h a2, fs7
96 # CHECK-ASM-AND-OBJ: feq.h a1, fs8, fs9
97 # CHECK-ASM: encoding: [0xd3,0x25,0x9c,0xa5]
98 feq.h a1, fs8, fs9
99 # CHECK-ASM-AND-OBJ: flt.h a2, fs10, fs11
100 # CHECK-ASM: encoding: [0x53,0x16,0xbd,0xa5]
101 flt.h a2, fs10, fs11
102 # CHECK-ASM-AND-OBJ: fle.h a3, ft8, ft9
103 # CHECK-ASM: encoding: [0xd3,0x06,0xde,0xa5]
104 fle.h a3, ft8, ft9
105 # CHECK-ASM-AND-OBJ: fclass.h a3, ft10
106 # CHECK-ASM: encoding: [0xd3,0x16,0x0f,0xe4]
107 fclass.h a3, ft10
108 # CHECK-ASM-AND-OBJ: fcvt.h.w ft11, a4, dyn
109 # CHECK-ASM: encoding: [0xd3,0x7f,0x07,0xd4]
110 fcvt.h.w ft11, a4, dyn
111 # CHECK-ASM-AND-OBJ: fcvt.h.wu ft0, a5, dyn
112 # CHECK-ASM: encoding: [0x53,0xf0,0x17,0xd4]
113 fcvt.h.wu ft0, a5, dyn
114 # CHECK-ASM-AND-OBJ: fmv.h.x ft1, a6
115 # CHECK-ASM: encoding: [0xd3,0x00,0x08,0xf4]
116 fmv.h.x ft1, a6
118 # Rounding modes
120 # CHECK-ASM-AND-OBJ: fmadd.h fa0, fa1, fa2, fa3, rne
121 # CHECK-ASM: encoding: [0x43,0x85,0xc5,0x6c]
122 fmadd.h f10, f11, f12, f13, rne
123 # CHECK-ASM-AND-OBJ: fmsub.h fa4, fa5, fa6, fa7, rtz
124 # CHECK-ASM: encoding: [0x47,0x97,0x07,0x8d]
125 fmsub.h f14, f15, f16, f17, rtz
126 # CHECK-ASM-AND-OBJ: fnmsub.h fs2, fs3, fs4, fs5, rdn
127 # CHECK-ASM: encoding: [0x4b,0xa9,0x49,0xad]
128 fnmsub.h f18, f19, f20, f21, rdn
129 # CHECK-ASM-AND-OBJ: fnmadd.h fs6, fs7, fs8, fs9, rup
130 # CHECK-ASM: encoding: [0x4f,0xbb,0x8b,0xcd]
131 fnmadd.h f22, f23, f24, f25, rup
132 # CHECK-ASM-AND-OBJ: fmadd.h fa0, fa1, fa2, fa3, rmm
133 # CHECK-ASM: encoding: [0x43,0xc5,0xc5,0x6c]
134 fmadd.h f10, f11, f12, f13, rmm
135 # CHECK-ASM-AND-OBJ: fmsub.h fa4, fa5, fa6, fa7
136 # CHECK-ASM: encoding: [0x47,0xf7,0x07,0x8d]
137 fmsub.h f14, f15, f16, f17, dyn
139 # CHECK-ASM-AND-OBJ: fadd.h fs10, fs11, ft8, rne
140 # CHECK-ASM: encoding: [0x53,0x8d,0xcd,0x05]
141 fadd.h f26, f27, f28, rne
142 # CHECK-ASM-AND-OBJ: fsub.h ft9, ft10, ft11, rtz
143 # CHECK-ASM: encoding: [0xd3,0x1e,0xff,0x0d]
144 fsub.h f29, f30, f31, rtz
145 # CHECK-ASM-AND-OBJ: fmul.h ft0, ft1, ft2, rdn
146 # CHECK-ASM: encoding: [0x53,0xa0,0x20,0x14]
147 fmul.h ft0, ft1, ft2, rdn
148 # CHECK-ASM-AND-OBJ: fdiv.h ft3, ft4, ft5, rup
149 # CHECK-ASM: encoding: [0xd3,0x31,0x52,0x1c]
150 fdiv.h ft3, ft4, ft5, rup
152 # CHECK-ASM-AND-OBJ: fsqrt.h ft6, ft7, rmm
153 # CHECK-ASM: encoding: [0x53,0xc3,0x03,0x5c]
154 fsqrt.h ft6, ft7, rmm
155 # CHECK-ASM-AND-OBJ: fcvt.w.h a0, fs5, rup
156 # CHECK-ASM: encoding: [0x53,0xb5,0x0a,0xc4]
157 fcvt.w.h a0, fs5, rup
158 # CHECK-ASM-AND-OBJ: fcvt.wu.h a1, fs6, rdn
159 # CHECK-ASM: encoding: [0xd3,0x25,0x1b,0xc4]
160 fcvt.wu.h a1, fs6, rdn
161 # CHECK-ASM-AND-OBJ: fcvt.h.w ft11, a4, rtz
162 # CHECK-ASM: encoding: [0xd3,0x1f,0x07,0xd4]
163 fcvt.h.w ft11, a4, rtz
164 # CHECK-ASM-AND-OBJ: fcvt.h.wu ft0, a5, rne
165 # CHECK-ASM: encoding: [0x53,0x80,0x17,0xd4]
166 fcvt.h.wu ft0, a5, rne