aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll
blob: 6bc7ce34d1c2239b2df9578779167ef2bf67a24e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
; 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* %0, align 4		; <float> [#uses=1]
	store float %3, float* %retval, align 4
	br label %return

return:		; preds = %entry
	%retval1 = load 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* %0, align 4		; <float> [#uses=1]
	store float %3, float* %retval, align 4
	br label %return

return:		; preds = %entry
	%retval1 = load 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* %0, align 4		; <float> [#uses=1]
	store float %3, float* %retval, align 4
	br label %return

return:		; preds = %entry
	%retval1 = load 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* %0, align 4		; <float> [#uses=1]
	store float %3, float* %retval, align 4
	br label %return

return:		; preds = %entry
	%retval1 = load float* %retval		; <float> [#uses=1]
	ret float %retval1
}