1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll
David Blaikie ab043ff680 [opaque pointer type] Add textual IR support for explicit type parameter to load instruction
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

llvm-svn: 230794
2015-02-27 21:17:42 +00:00

76 lines
2.6 KiB
LLVM

; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x3FB99999A0000000 | count 2
; RUN: opt < %s -simplifycfg -instcombine -S | grep 0xBFB99999A0000000 | count 2
; check constant folding for 'frem'. PR 3316.
; ModuleID = 'tt.c'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9.6"
define float @test1() nounwind {
entry:
%retval = alloca float ; <float*> [#uses=2]
%0 = alloca float ; <float*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%1 = frem double 1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
%3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
%retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}
define float @test2() nounwind {
entry:
%retval = alloca float ; <float*> [#uses=2]
%0 = alloca float ; <float*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%1 = frem double -1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
%3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
%retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}
define float @test3() nounwind {
entry:
%retval = alloca float ; <float*> [#uses=2]
%0 = alloca float ; <float*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%1 = frem double 1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
%3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
%retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}
define float @test4() nounwind {
entry:
%retval = alloca float ; <float*> [#uses=2]
%0 = alloca float ; <float*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%1 = frem double -1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
%3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
%retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}