brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 18ded50 Raw
98 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-- -mattr=+sse4.1 | FileCheck %s3 4; Test that when we don't, we don't do the optimization5; -0 - (A - B) to (B - A) because A==B, -0 != 06 7define float @negfp(float %a, float %b) nounwind {8; CHECK-LABEL: negfp:9; CHECK:       # %bb.0: # %entry10; CHECK-NEXT:    pushl %eax11; CHECK-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero12; CHECK-NEXT:    subss {{[0-9]+}}(%esp), %xmm013; CHECK-NEXT:    xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm014; CHECK-NEXT:    movss %xmm0, (%esp)15; CHECK-NEXT:    flds (%esp)16; CHECK-NEXT:    popl %eax17; CHECK-NEXT:    retl18entry:19	%sub = fsub float %a, %b		; <float> [#uses=1]20	%neg = fsub float -0.000000e+00, %sub		; <float> [#uses=1]21	ret float %neg22}23 24; This may infinite loop if isNegatibleForFree and getNegatedExpression are conflicted.25 26define double @negation_propagation(ptr %arg, double %arg1, double %arg2) nounwind {27; CHECK-LABEL: negation_propagation:28; CHECK:       # %bb.0:29; CHECK-NEXT:    pushl %ebp30; CHECK-NEXT:    movl %esp, %ebp31; CHECK-NEXT:    andl $-8, %esp32; CHECK-NEXT:    subl $8, %esp33; CHECK-NEXT:    movsd {{.*#+}} xmm0 = [1.0E+0,0.0E+0]34; CHECK-NEXT:    divsd 12(%ebp), %xmm035; CHECK-NEXT:    movsd {{.*#+}} xmm1 = mem[0],zero36; CHECK-NEXT:    mulsd %xmm0, %xmm137; CHECK-NEXT:    movapd %xmm0, %xmm238; CHECK-NEXT:    mulsd %xmm0, %xmm239; CHECK-NEXT:    mulsd %xmm0, %xmm240; CHECK-NEXT:    subsd %xmm2, %xmm141; CHECK-NEXT:    movsd %xmm1, (%esp)42; CHECK-NEXT:    fldl (%esp)43; CHECK-NEXT:    movl %ebp, %esp44; CHECK-NEXT:    popl %ebp45; CHECK-NEXT:    retl46  %t = fdiv double 1.0, %arg147  %t7 = fmul double %t, %arg248  %t10 = fneg double %t749  %t11 = fmul double %t, %t50  %t13 = fsub double %t11, %t51  %t14 = fneg double %t52  %t15 = fmul double %t, %t1453  %t16 = fmul double %t, %t1554  %t18 = fadd double %t16, %t755  ret double %t1856}57 58; This would crash because the negated expression for %sub459; creates a new use of %sub1 and that alters the negated cost60 61define float @fdiv_extra_use_changes_cost(float %a0, float %a1, float %a2) nounwind {62; CHECK-LABEL: fdiv_extra_use_changes_cost:63; CHECK:       # %bb.0:64; CHECK-NEXT:    pushl %eax65; CHECK-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero66; CHECK-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero67; CHECK-NEXT:    subss {{[0-9]+}}(%esp), %xmm168; CHECK-NEXT:    movaps %xmm1, %xmm269; CHECK-NEXT:    mulss %xmm0, %xmm270; CHECK-NEXT:    subss %xmm1, %xmm071; CHECK-NEXT:    divss %xmm2, %xmm072; CHECK-NEXT:    movss %xmm0, (%esp)73; CHECK-NEXT:    flds (%esp)74; CHECK-NEXT:    popl %eax75; CHECK-NEXT:    retl76  %sub1 = fsub fast float %a0, %a177  %mul2 = fmul fast float %sub1, %a278  %neg = fneg fast float %a079  %add3 = fadd fast float %a1, %neg80  %sub4 = fadd fast float %add3, %a281  %div5 = fdiv fast float %sub4, %mul282  ret float %div583}84 85; PR55758 - this is not -(-X)86 87define <2 x i64> @fneg_mismatched_sizes(<4 x float> %x) {88; CHECK-LABEL: fneg_mismatched_sizes:89; CHECK:       # %bb.0:90; CHECK-NEXT:    xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm091; CHECK-NEXT:    xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm092; CHECK-NEXT:    retl93  %n = fneg <4 x float> %x94  %b = bitcast <4 x float> %n to <2 x i64>95  %r = xor <2 x i64> %b, <i64 -9223372036854775808, i64 -9223372036854775808>96  ret <2 x i64> %r97}98