xref: /llvm-project/llvm/test/CodeGen/RISCV/compress-float.ll (revision c532ba4edd7ad7675ba450ba43268aa9e7bda46b)
1ca950a6bSSimon Cook; This test is designed to run three times, once with function attributes, once
2ca950a6bSSimon Cook; with all target attributes added on the command line, and once with compress
3ca950a6bSSimon Cook; added with the command line and float added via function attributes, all
4ca950a6bSSimon Cook; three of these should result in the same output.
5ca950a6bSSimon Cook;
6ca950a6bSSimon Cook; RUN: cat %s > %t.tgtattr
7ca950a6bSSimon Cook; RUN: echo 'attributes #0 = { nounwind }' >> %t.tgtattr
86e4be7e1SCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+c,+f -filetype=obj \
9ca950a6bSSimon Cook; RUN:   -disable-block-placement < %t.tgtattr \
106e4be7e1SCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+c,+f -M no-aliases - \
11ca950a6bSSimon Cook; RUN:   | FileCheck -check-prefix=RV32IFDC %s
12ca950a6bSSimon Cook;
13ca950a6bSSimon Cook; RUN: cat %s > %t.fnattr
146e4be7e1SCraig Topper; RUN: echo 'attributes #0 = { nounwind "target-features"="+c,+f" }' >> %t.fnattr
156e4be7e1SCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -filetype=obj \
16ca950a6bSSimon Cook; RUN:   -disable-block-placement < %t.fnattr \
176e4be7e1SCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+c,+f -M no-aliases - \
18ca950a6bSSimon Cook; RUN:   | FileCheck -check-prefix=RV32IFDC %s
19ca950a6bSSimon Cook;
20ca950a6bSSimon Cook; RUN: cat %s > %t.mixedattr
216e4be7e1SCraig Topper; RUN: echo 'attributes #0 = { nounwind "target-features"="+f" }' >> %t.mixedattr
226e4be7e1SCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+c -filetype=obj \
23ca950a6bSSimon Cook; RUN:   -disable-block-placement < %t.mixedattr \
246e4be7e1SCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+c,+f -M no-aliases - \
256e4be7e1SCraig Topper; RUN:   | FileCheck -check-prefix=RV32IFDC %s
266e4be7e1SCraig Topper;
276e4be7e1SCraig Topper; RUN: cat %s > %t.tgtattr
286e4be7e1SCraig Topper; RUN: echo 'attributes #0 = { nounwind }' >> %t.tgtattr
296e4be7e1SCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+zcf,+f -filetype=obj \
306e4be7e1SCraig Topper; RUN:   -disable-block-placement < %t.tgtattr \
316e4be7e1SCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+zcf,+f -M no-aliases - \
326e4be7e1SCraig Topper; RUN:   | FileCheck -check-prefix=RV32IFDC %s
336e4be7e1SCraig Topper;
346e4be7e1SCraig Topper; RUN: cat %s > %t.fnattr
356e4be7e1SCraig Topper; RUN: echo 'attributes #0 = { nounwind "target-features"="+zcf,+f" }' >> %t.fnattr
366e4be7e1SCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -filetype=obj \
376e4be7e1SCraig Topper; RUN:   -disable-block-placement < %t.fnattr \
386e4be7e1SCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+zcf,+f -M no-aliases - \
396e4be7e1SCraig Topper; RUN:   | FileCheck -check-prefix=RV32IFDC %s
406e4be7e1SCraig Topper;
416e4be7e1SCraig Topper; RUN: cat %s > %t.mixedattr
426e4be7e1SCraig Topper; RUN: echo 'attributes #0 = { nounwind "target-features"="+f" }' >> %t.mixedattr
436e4be7e1SCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+zcf -filetype=obj \
446e4be7e1SCraig Topper; RUN:   -disable-block-placement < %t.mixedattr \
456e4be7e1SCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+zcf,+f -M no-aliases - \
46ca950a6bSSimon Cook; RUN:   | FileCheck -check-prefix=RV32IFDC %s
470aecddceSCraig Topper;
480aecddceSCraig Topper; RUN: cat %s > %t.tgtattr
490aecddceSCraig Topper; RUN: echo 'attributes #0 = { nounwind }' >> %t.tgtattr
500aecddceSCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+zce,+f -filetype=obj \
510aecddceSCraig Topper; RUN:   -disable-block-placement < %t.tgtattr \
520aecddceSCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+zce,+f -M no-aliases - \
530aecddceSCraig Topper; RUN:   | FileCheck -check-prefix=RV32IFDC %s
540aecddceSCraig Topper;
550aecddceSCraig Topper; RUN: cat %s > %t.fnattr
560aecddceSCraig Topper; RUN: echo 'attributes #0 = { nounwind "target-features"="+zce,+f" }' >> %t.fnattr
570aecddceSCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -filetype=obj \
580aecddceSCraig Topper; RUN:   -disable-block-placement < %t.fnattr \
590aecddceSCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+zce,+f -M no-aliases - \
600aecddceSCraig Topper; RUN:   | FileCheck -check-prefix=RV32IFDC %s
610aecddceSCraig Topper;
620aecddceSCraig Topper; RUN: cat %s > %t.mixedattr
630aecddceSCraig Topper; RUN: echo 'attributes #0 = { nounwind "target-features"="+f" }' >> %t.mixedattr
640aecddceSCraig Topper; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+zce -filetype=obj \
650aecddceSCraig Topper; RUN:   -disable-block-placement < %t.mixedattr \
660aecddceSCraig Topper; RUN:   | llvm-objdump -d --triple=riscv32 --mattr=+zce,+f -M no-aliases - \
670aecddceSCraig Topper; RUN:   | FileCheck -check-prefix=RV32IFDC %s
68ca950a6bSSimon Cook
697f7dac71SZarko Todorovski; This acts as a basic correctness check for the codegen instruction compression
707f7dac71SZarko Todorovski; path, verifying that the assembled file contains compressed instructions when
71ca950a6bSSimon Cook; expected. Handling of the compressed ISA is implemented so the same
72ca950a6bSSimon Cook; transformation patterns should be used whether compressing an input .s file or
737f7dac71SZarko Todorovski; compressing codegen output. This file contains basic functionality tests using
74ca950a6bSSimon Cook; instructions which also require one of the floating point extensions.
75ca950a6bSSimon Cook
761456b686SNikita Popovdefine float @float_load(ptr %a) #0 {
7771e2ca6eSFangrui Song; RV32IFDC-LABEL: <float_load>:
78*c532ba4eSWang Yaduo; RV32IFDC:         c.flw fa0, 0x0(a0)
79ca950a6bSSimon Cook; RV32IFDC-NEXT:    c.jr ra
801456b686SNikita Popov  %1 = load volatile float, ptr %a
81ca950a6bSSimon Cook  ret float %1
82ca950a6bSSimon Cook}
83