1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -march=amdgcn -mcpu=gfx1030 -start-before=amdgpu-isel -stop-after=amdgpu-isel < %s | FileCheck %s
4 define void @main(float %arg) {
5 ; CHECK-LABEL: name: main
7 ; CHECK-NEXT: successors: %bb.1(0x50000000), %bb.2(0x30000000)
8 ; CHECK-NEXT: liveins: $vgpr0
10 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
11 ; CHECK-NEXT: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 0
12 ; CHECK-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 -1
13 ; CHECK-NEXT: [[DEF:%[0-9]+]]:sgpr_32 = IMPLICIT_DEF
14 ; CHECK-NEXT: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 $exec_lo, [[S_MOV_B32_1]], implicit-def dead $scc
15 ; CHECK-NEXT: $vcc_lo = COPY [[S_AND_B32_]]
16 ; CHECK-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
17 ; CHECK-NEXT: S_BRANCH %bb.1
19 ; CHECK-NEXT: bb.1.bb2:
20 ; CHECK-NEXT: successors: %bb.2(0x80000000)
22 ; CHECK-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 1065353216, implicit $exec
23 ; CHECK-NEXT: [[V_FMAC_F32_e64_:%[0-9]+]]:vgpr_32 = contract reassoc nofpexcept V_FMAC_F32_e64 0, [[S_MOV_B32_]], 0, [[S_MOV_B32_]], 0, [[V_MOV_B32_e32_]], 0, 0, implicit $mode, implicit $exec
24 ; CHECK-NEXT: [[V_FMAC_F32_e64_1:%[0-9]+]]:vgpr_32 = contract reassoc nofpexcept V_FMAC_F32_e64 0, [[COPY]], 0, [[COPY]], 0, [[V_FMAC_F32_e64_]], 0, 0, implicit $mode, implicit $exec
25 ; CHECK-NEXT: [[V_ADD_F32_e64_:%[0-9]+]]:vgpr_32 = contract reassoc nofpexcept V_ADD_F32_e64 0, [[V_FMAC_F32_e64_1]], 0, [[V_MOV_B32_e32_]], 0, 0, implicit $mode, implicit $exec
26 ; CHECK-NEXT: [[S_MOV_B32_2:%[0-9]+]]:sreg_32 = S_MOV_B32 0
28 ; CHECK-NEXT: bb.2.bb11:
29 ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000)
31 ; CHECK-NEXT: [[PHI:%[0-9]+]]:vgpr_32 = PHI [[DEF]], %bb.0, [[V_FMAC_F32_e64_1]], %bb.1
32 ; CHECK-NEXT: [[PHI1:%[0-9]+]]:vgpr_32 = PHI [[DEF]], %bb.0, [[V_ADD_F32_e64_]], %bb.1
33 ; CHECK-NEXT: [[PHI2:%[0-9]+]]:sreg_32_xm0_xexec = PHI [[S_MOV_B32_1]], %bb.0, [[S_MOV_B32_2]], %bb.1
34 ; CHECK-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, [[PHI2]], implicit $exec
35 ; CHECK-NEXT: [[S_MOV_B32_3:%[0-9]+]]:sreg_32 = S_MOV_B32 1
36 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[V_CNDMASK_B32_e64_]]
37 ; CHECK-NEXT: S_CMP_LG_U32 killed [[COPY1]], killed [[S_MOV_B32_3]], implicit-def $scc
38 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
39 ; CHECK-NEXT: [[S_AND_B32_1:%[0-9]+]]:sreg_32 = S_AND_B32 $exec_lo, killed [[COPY2]], implicit-def dead $scc
40 ; CHECK-NEXT: $vcc_lo = COPY [[S_AND_B32_1]]
41 ; CHECK-NEXT: S_CBRANCH_VCCNZ %bb.4, implicit $vcc
42 ; CHECK-NEXT: S_BRANCH %bb.3
44 ; CHECK-NEXT: bb.3.bb15:
45 ; CHECK-NEXT: successors: %bb.4(0x80000000)
48 ; CHECK-NEXT: bb.4.bb17:
49 ; CHECK-NEXT: SI_RETURN
51 %i = fadd reassoc contract float 0.000000e+00, 0.000000e+00
52 %i1 = icmp ne i32 0, 0
53 br i1 %i1, label %bb2, label %bb11
56 %i3 = fmul reassoc contract float %i, %i
57 %i4 = fmul reassoc contract float %arg, %arg
58 %i5 = fadd reassoc contract float %i3, 1.000000e+00
59 %i6 = fadd reassoc contract float %i5, %i4
60 %i7 = fmul reassoc contract float %arg, %arg
61 %i8 = fmul reassoc contract float %i, %i
62 %i9 = fadd reassoc contract float %i7, %i8
63 %i10 = fadd reassoc contract float %i9, 1.000000e+00
67 %i12 = phi float [ %i6, %bb2 ], [ undef, %bb ]
68 %i13 = phi float [ %i10, %bb2 ], [ undef, %bb ]
69 %i14 = phi i1 [ false, %bb2 ], [ true, %bb ]
70 br i1 %i14, label %bb15, label %bb17
73 %i16 = fmul reassoc contract float %i, 0.000000e+00
77 %i18 = phi float [ %i13, %bb11 ], [ 0.000000e+00, %bb15 ]
78 %i19 = phi float [ %i12, %bb11 ], [ 0.000000e+00, %bb15 ]
82 define float @test2(float %arg, float %arg1) {
83 ; CHECK-LABEL: name: test2
85 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1
87 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr1
88 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
89 ; CHECK-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 -1082130432, implicit $exec
90 ; CHECK-NEXT: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 1120534528
91 ; CHECK-NEXT: [[V_FMAC_F32_e64_:%[0-9]+]]:vgpr_32 = nsz contract reassoc nofpexcept V_FMAC_F32_e64 0, [[COPY]], 0, killed [[S_MOV_B32_]], 0, [[V_MOV_B32_e32_]], 0, 0, implicit $mode, implicit $exec
92 ; CHECK-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sgpr_32 = S_MOV_B32 0
93 ; CHECK-NEXT: [[V_FMAC_F32_e64_1:%[0-9]+]]:vgpr_32 = nsz contract reassoc nofpexcept V_FMAC_F32_e64 0, [[COPY1]], 0, killed [[S_MOV_B32_1]], 0, [[V_FMAC_F32_e64_]], 0, 0, implicit $mode, implicit $exec
94 ; CHECK-NEXT: [[V_ADD_F32_e64_:%[0-9]+]]:vgpr_32 = nsz contract reassoc nofpexcept V_ADD_F32_e64 0, [[V_FMAC_F32_e64_1]], 0, [[V_MOV_B32_e32_]], 0, 0, implicit $mode, implicit $exec
95 ; CHECK-NEXT: [[V_RCP_F32_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_RCP_F32_e64 0, [[V_FMAC_F32_e64_1]], 0, 0, implicit $mode, implicit $exec
96 ; CHECK-NEXT: [[V_RCP_F32_e64_1:%[0-9]+]]:vgpr_32 = nofpexcept V_RCP_F32_e64 0, killed [[V_ADD_F32_e64_]], 0, 0, implicit $mode, implicit $exec
97 ; CHECK-NEXT: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[V_RCP_F32_e64_1]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
98 ; CHECK-NEXT: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_MAX_F32_e64 0, killed [[V_MUL_F32_e64_]], 0, [[V_RCP_F32_e64_1]], 0, 0, implicit $mode, implicit $exec
99 ; CHECK-NEXT: [[V_ADD_F32_e64_1:%[0-9]+]]:vgpr_32 = nofpexcept V_ADD_F32_e64 0, killed [[V_MAX_F32_e64_]], 0, killed [[V_RCP_F32_e64_]], 0, 0, implicit $mode, implicit $exec
100 ; CHECK-NEXT: $vgpr0 = COPY [[V_ADD_F32_e64_1]]
101 ; CHECK-NEXT: SI_RETURN implicit $vgpr0
103 %i = fmul contract float %arg1, 1.000000e+02
104 %i2 = fmul contract float %arg, 0.000000e+00
105 %i3 = fadd reassoc nsz contract float %i, %arg1
106 %i4 = fadd nsz contract float %i3, %i2
107 %i5 = fsub reassoc nsz contract float 1.000000e+00, %i4
108 %i6 = fdiv afn float 1.000000e+00, %i5
109 %i7 = fneg float %arg
110 %i9 = fmul float %i6, %i7
111 %i10 = fmul float %i6, -1.000000e+00
112 %i13 = call float @llvm.maxnum.f32(float %i9, float %i10)
113 %ret = fadd float %i10, %i13
117 declare float @llvm.maxnum.f32(float, float)