1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ;RUN: llc < %s -mtriple=riscv64 -mattr=+f -mcpu=sifive-u74 -target-abi=lp64f \
3 ;RUN: | FileCheck %s --check-prefix=NOFUSION
4 ;RUN: llc < %s -mtriple=riscv64 -mattr=+f,+lui-addi-fusion -mcpu=sifive-u74 \
5 ;RUN: -target-abi=lp64f | FileCheck %s --check-prefix=FUSION
6 ;RUN: llc < %s -mtriple=riscv64 -mattr=+f,+lui-addi-fusion,+use-postra-scheduler -mcpu=sifive-u74 \
7 ;RUN: -target-abi=lp64f | FileCheck %s --check-prefixes=FUSION-POSTRA
9 @.str = private constant [4 x i8] c"%f\0A\00", align 1
11 define void @foo(i32 signext %0, i32 signext %1) {
12 ; NOFUSION-LABEL: foo:
14 ; NOFUSION-NEXT: lui a0, %hi(.L.str)
15 ; NOFUSION-NEXT: fcvt.s.w fa0, a1
16 ; NOFUSION-NEXT: addi a0, a0, %lo(.L.str)
17 ; NOFUSION-NEXT: tail bar
21 ; FUSION-NEXT: lui a0, %hi(.L.str)
22 ; FUSION-NEXT: addi a0, a0, %lo(.L.str)
23 ; FUSION-NEXT: fcvt.s.w fa0, a1
24 ; FUSION-NEXT: tail bar
26 ; FUSION-POSTRA-LABEL: foo:
27 ; FUSION-POSTRA: # %bb.0:
28 ; FUSION-POSTRA-NEXT: lui a0, %hi(.L.str)
29 ; FUSION-POSTRA-NEXT: addi a0, a0, %lo(.L.str)
30 ; FUSION-POSTRA-NEXT: fcvt.s.w fa0, a1
31 ; FUSION-POSTRA-NEXT: tail bar
32 %3 = sitofp i32 %1 to float
33 tail call void @bar(ptr @.str, float %3)
37 declare void @bar(ptr, float)
39 ; Test that we prefer lui+addiw over li+slli.
40 define i32 @test_matint() {
41 ; NOFUSION-LABEL: test_matint:
43 ; NOFUSION-NEXT: li a0, 1
44 ; NOFUSION-NEXT: slli a0, a0, 11
47 ; FUSION-LABEL: test_matint:
49 ; FUSION-NEXT: lui a0, 1
50 ; FUSION-NEXT: addiw a0, a0, -2048
53 ; FUSION-POSTRA-LABEL: test_matint:
54 ; FUSION-POSTRA: # %bb.0:
55 ; FUSION-POSTRA-NEXT: lui a0, 1
56 ; FUSION-POSTRA-NEXT: addiw a0, a0, -2048
57 ; FUSION-POSTRA-NEXT: ret