mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-24 09:29:42 +00:00
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
55 lines
1.6 KiB
LLVM
55 lines
1.6 KiB
LLVM
; RUN: opt -S -instcombine < %s | FileCheck %s
|
|
|
|
define float @test1(float %x) nounwind readnone ssp {
|
|
entry:
|
|
; CHECK-LABEL: @test1(
|
|
; CHECK-NOT: fpext
|
|
; CHECK-NOT: sqrt(
|
|
; CHECK: sqrtf(
|
|
; CHECK-NOT: fptrunc
|
|
%conv = fpext float %x to double ; <double> [#uses=1]
|
|
%call = tail call double @sqrt(double %conv) readnone nounwind ; <double> [#uses=1]
|
|
%conv1 = fptrunc double %call to float ; <float> [#uses=1]
|
|
; CHECK: ret float
|
|
ret float %conv1
|
|
}
|
|
|
|
; PR8096
|
|
define float @test2(float %x) nounwind readnone ssp {
|
|
entry:
|
|
; CHECK-LABEL: @test2(
|
|
; CHECK-NOT: fpext
|
|
; CHECK-NOT: sqrt(
|
|
; CHECK: sqrtf(
|
|
; CHECK-NOT: fptrunc
|
|
%conv = fpext float %x to double ; <double> [#uses=1]
|
|
%call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1]
|
|
%conv1 = fptrunc double %call to float ; <float> [#uses=1]
|
|
; CHECK: ret float
|
|
ret float %conv1
|
|
}
|
|
|
|
; rdar://9763193
|
|
; Can't fold (fptrunc (sqrt (fpext x))) -> (sqrtf x) since there is another
|
|
; use of sqrt result.
|
|
define float @test3(float* %v) nounwind uwtable ssp {
|
|
entry:
|
|
; CHECK-LABEL: @test3(
|
|
; CHECK: sqrt(
|
|
; CHECK-NOT: sqrtf(
|
|
; CHECK: fptrunc
|
|
%arrayidx13 = getelementptr inbounds float, float* %v, i64 2
|
|
%tmp14 = load float, float* %arrayidx13
|
|
%mul18 = fmul float %tmp14, %tmp14
|
|
%add19 = fadd float undef, %mul18
|
|
%conv = fpext float %add19 to double
|
|
%call34 = call double @sqrt(double %conv) readnone
|
|
%call36 = call i32 (double)* @foo(double %call34) nounwind
|
|
%conv38 = fptrunc double %call34 to float
|
|
ret float %conv38
|
|
}
|
|
|
|
declare i32 @foo(double)
|
|
|
|
declare double @sqrt(double) readnone
|