1; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=avx < %s | FileCheck %s 2 3define float @test1(float %a) #0 { 4; CHECK-LABEL: test1: 5; CHECK: # %bb.0: 6; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0 7; CHECK-NEXT: retq 8 %t1 = fadd nnan reassoc nsz float %a, %a 9 %r = fadd nnan reassoc nsz float %t1, %t1 10 ret float %r 11} 12 13define float @test2(float %a) #0 { 14; CHECK-LABEL: test2: 15; CHECK: # %bb.0: 16; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0 17; CHECK-NEXT: retq 18 %t1 = fmul nnan reassoc nsz float 4.0, %a 19 %t2 = fadd nnan reassoc nsz float %a, %a 20 %r = fadd nnan reassoc nsz float %t1, %t2 21 ret float %r 22} 23 24define float @test3(float %a) #0 { 25; CHECK-LABEL: test3: 26; CHECK: # %bb.0: 27; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0 28; CHECK-NEXT: retq 29 %t1 = fmul nnan reassoc nsz float %a, 4.0 30 %t2 = fadd nnan reassoc nsz float %a, %a 31 %r = fadd nnan reassoc nsz float %t1, %t2 32 ret float %r 33} 34 35define float @test4(float %a) #0 { 36; CHECK-LABEL: test4: 37; CHECK: # %bb.0: 38; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0 39; CHECK-NEXT: retq 40 %t1 = fadd nnan reassoc nsz float %a, %a 41 %t2 = fmul nnan reassoc nsz float 4.0, %a 42 %r = fadd nnan reassoc nsz float %t1, %t2 43 ret float %r 44} 45 46define float @test5(float %a) #0 { 47; CHECK-LABEL: test5: 48; CHECK: # %bb.0: 49; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0 50; CHECK-NEXT: retq 51 %t1 = fadd nnan reassoc nsz float %a, %a 52 %t2 = fmul nnan reassoc nsz float %a, 4.0 53 %r = fadd nnan reassoc nsz float %t1, %t2 54 ret float %r 55} 56 57define float @test6(float %a) #0 { 58; CHECK-LABEL: test6: 59; CHECK: # %bb.0: 60; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0 61; CHECK-NEXT: retq 62 %t1 = fmul nnan reassoc nsz float 2.0, %a 63 %t2 = fadd nnan reassoc nsz float %a, %a 64 %r = fsub nnan reassoc nsz float %t1, %t2 65 ret float %r 66} 67 68define float @test7(float %a) #0 { 69; CHECK-LABEL: test7: 70; CHECK: # %bb.0: 71; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0 72; CHECK-NEXT: retq 73 %t1 = fmul nnan reassoc nsz float %a, 2.0 74 %t2 = fadd nnan reassoc nsz float %a, %a 75 %r = fsub nnan reassoc nsz float %t1, %t2 76 ret float %r 77} 78 79define float @test8(float %a) #0 { 80; CHECK-LABEL: test8: 81; CHECK: # %bb.0: 82; CHECK-NEXT: retq 83 %t1 = fmul nsz float %a, 0.0 84 %t2 = fadd nnan reassoc nsz float %a, %t1 85 ret float %t2 86} 87 88define float @test9(float %a) #0 { 89; CHECK-LABEL: test9: 90; CHECK: # %bb.0: 91; CHECK-NEXT: retq 92 %t1 = fmul nsz float 0.0, %a 93 %t2 = fadd nnan reassoc nsz float %t1, %a 94 ret float %t2 95} 96 97define float @test10(float %a) #0 { 98; CHECK-LABEL: test10: 99; CHECK: # %bb.0: 100; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0 101; CHECK-NEXT: retq 102 %t1 = fsub nsz float -0.0, %a 103 %t2 = fadd nnan reassoc nsz float %a, %t1 104 ret float %t2 105} 106 107