Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/test/Transforms/InstCombine/fmul.ll
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | define float @test11(float %x, float %y) { | ||||
%a = fadd fast float %x, 1.0 | %a = fadd fast float %x, 1.0 | ||||
%b = fadd fast float %y, 2.0 | %b = fadd fast float %y, 2.0 | ||||
%c = fadd fast float %a, %b | %c = fadd fast float %a, %b | ||||
ret float %c | ret float %c | ||||
; CHECK-LABEL: @test11( | ; CHECK-LABEL: @test11( | ||||
; CHECK-NOT: fadd float | ; CHECK-NOT: fadd float | ||||
; CHECK: fadd fast float | ; CHECK: fadd fast float | ||||
} | } | ||||
; PR21126: http://llvm.org/bugs/show_bug.cgi?id=21126 | |||||
; With unsafe/fast math, sqrt(X) * sqrt(X) is just X. | |||||
declare double @llvm.sqrt.f64(double) | |||||
define double @sqrt_squared1(double %f) #0 { | |||||
%sqrt = call double @llvm.sqrt.f64(double %f) | |||||
%mul = fmul fast double %sqrt, %sqrt | |||||
ret double %mul | |||||
; CHECK-LABEL: @sqrt_squared1( | |||||
; CHECK-NEXT: ret double %f | |||||
} | |||||
; With unsafe/fast math, sqrt(X) * sqrt(X) is just X, | |||||
; but make sure another use of the sqrt is intact. | |||||
; Note that the remaining fmul is altered but is not 'fast' | |||||
; itself because it was not marked 'fast' originally. | |||||
; Thus, we have an overall fast result, but no more indication of | |||||
; 'fast'ness in the code. | |||||
define double @sqrt_squared2(double %f) #0 { | |||||
%sqrt = call double @llvm.sqrt.f64(double %f) | |||||
%mul1 = fmul fast double %sqrt, %sqrt | |||||
%mul2 = fmul double %mul1, %sqrt | |||||
ret double %mul2 | |||||
; CHECK-LABEL: @sqrt_squared2( | |||||
; CHECK-NEXT: %sqrt = call double @llvm.sqrt.f64(double %f) | |||||
; CHECK-NEXT: %mul2 = fmul double %sqrt, %f | |||||
; CHECK-NEXT: ret double %mul2 | |||||
} |