llvm.org GIT mirror llvm / c2ec2ba
Change all floating constants that are not exactly representable to use hex format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41722 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 12 years ago
21 changed file(s) with 32 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
55
66 float "test"()
77 begin
8 %tmp = mul float 1.0e100, 1.0e1
8 %tmp = mul float 0x7FF0000000000000, 1.0e1
99 ret float %tmp
1010 end
22 define void @foo(<8 x float>* %f, <8 x float>* %g, <4 x i64>* %y)
33 {
44 %h = load <8 x float>* %f
5 %i = mul <8 x float> %h, 1.1, float 3.3, float 4.4, float 5.4, float 0.5, float 0.6, float 0.7, float 0.8>
5 %i = mul <8 x float> %h, 0x3FF19999A0000000, float 0x400A666660000000, float 0x40119999A0000000, float 0x40159999A0000000, float 0.5, float 0x3FE3333340000000, float 0x3FE6666660000000, float 0x3FE99999A0000000>
66 %m = bitcast <8 x float> %i to <4 x i64>
77 %z = load <4 x i64>* %y
88 %n = mul <4 x i64> %z, %m
3737 }
3838
3939 int %main(int %argc, sbyte** %argv) {
40 %a = call int %test1(float 3.1415926)
40 %a = call int %test1(float 0x400921FB40000000)
4141 %b = call float %test2(int %a)
42 %c = call long %test3(double 3.1415926)
42 %c = call long %test3(double 0x400921FB4D12D84A)
4343 %d = call double %test4(long %c)
4444 %e = call double %test5(double 7.0)
4545 %f = call float %test6(float 7.0)
1919 %z1 = add float %x1, %y1 ;; z1 = x1 + y1
2020
2121 %x2 = mul float %x, 0.5 ;; x2
22 %y2 = mul float %y, 0.9 ;; y2
22 %y2 = mul float %y, 0x3FECCCCCC0000000 ;; y2
2323 %z2 = add float %x2, %y2 ;; z2 = x2 + y2
2424
2525 %z3 = add float %z1, %z2 ;; z3 = z1 + z2
2020 %ArrayB = alloca %MixedB, uint 3
2121
2222 %I1 = getelementptr %MixedA* %ScalarA, long 0, uint 0
23 store float 1.4142, float *%I1
23 store float 0x3FF6A09020000000, float *%I1
2424 %I2 = getelementptr %MixedB* %ScalarB, long 0, uint 1, uint 0
25 store float 2.7183, float *%I2
25 store float 0x4005BF1420000000, float *%I2
2626
2727 %fptrA = getelementptr %MixedA* %ArrayA, long 1, uint 0
2828 %fptrB = getelementptr %MixedB* %ArrayB, long 2, uint 1, uint 0
2929
30 store float 3.1415, float* %fptrA
30 store float 0x400921CAC0000000, float* %fptrA
3131 store float 5.0, float* %fptrB
3232
3333 ;; Test that a sequence of GEPs with constant indices are folded right
1212 %z1 = add float %x1, %y1 ;; z1 = x1 + y1
1313
1414 %x2 = mul float %x, 0.5 ;; x2
15 %y2 = mul float %y, 0.9 ;; y2
15 %y2 = mul float %y, 0x3FECCCCCC0000000 ;; y2
1616 %z2 = add float %x2, %y2 ;; z2 = x2 + y2
1717
1818 %z3 = add float %z1, %z2 ;; z3 = z1 + z2
1414 %i = add int %N, 12345678 ; constant has to be loaded
1515 %b = add short 4, 3 ; one of the operands shd be immed
1616 %c = add float %X, 0.0 ; will this be optimzzed?
17 %d = add float %X, 3.1415 ; constant has to be loaded
17 %d = add float %X, 0x400921CAC0000000 ; constant has to be loaded
1818 %f = add uint 4294967295, 10 ; result shd be 9 (not in immed fld)
1919 %g = add ushort 20, 65535 ; result shd be 19 (65536 in immed fld)
2020 %j = add ushort 65535, 30 ; result shd be 29 (not in immed fld)
6363
6464 void %test_cst(%f4 *%P, %f4 *%S) {
6565 %p = load %f4* %P
66 %R = add %f4 %p, .1, float 1.0, float 2.0, float 4.5>
66 %R = add %f4 %p, x3FB99999A0000000, float 1.0, float 2.0, float 4.5>
6767 store %f4 %R, %f4 *%S
6868 ret void
6969 }
6464
6565 void %test_cst(%f4 *%P, %f4 *%S) {
6666 %p = load %f4* %P
67 %R = add %f4 %p, .1, float 1.0, float 2.0, float 4.5>
67 %R = add %f4 %p, x3FB99999A0000000, float 1.0, float 2.0, float 4.5>
6868 store %f4 %R, %f4 *%S
6969 ret void
7070 }
55 ret float %c
66 }
77 define float @bar(float %a) {
8 %b = insertelement <4 x float> 3.4, float 4.5, float 0.0, float 9.2>, float %a, i32 3
8 %b = insertelement <4 x float> 0x400B333340000000, float 4.5, float 0.0, float 0x4022666660000000>, float %a, i32 3
99 %c = extractelement <4 x float> %b, i32 2
1010 ret float %c
1111 }
1111 implementation
1212
1313 void %testfloatstore() {
14 call void %extfloat(float 1234.4)
15 call void %extdouble(double 1234.4123)
16 store float 13.0123, float* %G
14 call void %extfloat(float 0x40934999A0000000)
15 call void %extdouble(double 0x409349A631F8A090)
16 store float 0x402A064C20000000, float* %G
1717 ret void
1818 }
1919
0 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse | grep movaps
11
22 define <4 x float> @foo() {
3 ret <4 x float> 3.223542354, float 2.3, float 1.2, float 0.1>
3 ret <4 x float> 0x4009C9D0A0000000, float 0x4002666660000000, float 0x3FF3333340000000, float 0x3FB99999A0000000>
44 }
6464
6565 void %test_cst(%f4 *%P, %f4 *%S) {
6666 %p = load %f4* %P
67 %R = add %f4 %p, .1, float 1.0, float 2.0, float 4.5>
67 %R = add %f4 %p, x3FB99999A0000000, float 1.0, float 2.0, float 4.5>
6868 store %f4 %R, %f4 *%S
6969 ret void
7070 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | not grep bitcast
11
22 int %test1() {
3 ret int bitcast(float 3.7 to int)
3 ret int bitcast(float 0x400D9999A0000000 to int)
44 }
55
66 float %test2() {
88 }
99
1010 long %test3() {
11 ret long bitcast (double 3.1415926 to long)
11 ret long bitcast (double 0x400921FB4D12D84A to long)
1212 }
1313
1414 double %test4() {
66 "&^ " = type { int }
77 "%.*+ foo" = global "&^ " { int 5 }
88 "0" = global float 0.0 ; This CANNOT be %0
9 "\03foo" = global float 0.1 ; Make sure funny char gets round trip
9 "\03foo" = global float 0x3FB99999A0000000 ; Make sure funny char gets round trip
1313 %t3 = zext i31 %i to i1280
1414 %t4 = sext i31 %i to i1280
1515
16 %t5 = fptoui float 3.14159 to i31
16 %t5 = fptoui float 0x400921FA00000000 to i31
1717 %t6 = uitofp i31 %t5 to double
1818
19 %t7 = fptosi double -1234.5678 to i28
19 %t7 = fptosi double 0xC0934A456D5CFAAD to i28
2020 %t8 = sitofp i8 -1 to double
2121 %t9 = uitofp i8 255 to double
2222
0 ; RUN: llvm-as < %s | llvm-dis | not grep bitcast
11
22 define i60 @test1() {
3 ret i60 fptoui(float 3.7 to i60)
3 ret i60 fptoui(float 0x400D9999A0000000 to i60)
44 }
55
66 define float @test2() {
88 }
99
1010 define i64 @test3() {
11 ret i64 bitcast (double 3.1415926 to i64)
11 ret i64 bitcast (double 0x400921FB4D12D84A to i64)
1212 }
1313
1414 define double @test4() {
1616 }
1717
1818 define i30 @test5() {
19 ret i30 fptoui(float 3.7 to i30)
19 ret i30 fptoui(float 0x400D9999A0000000 to i30)
2020 }
2121
2222 define float @test6() {
2424 }
2525
2626 define i64 @test7() {
27 ret i64 bitcast (double 3.1415926 to i64)
27 ret i64 bitcast (double 0x400921FB4D12D84A to i64)
2828 }
2929
3030 define double @test8() {
1212 }
1313
1414 float %test3() {
15 %R = rem float 12.45, 123.213
15 %R = rem float 0x4028E66660000000, 0x405ECDA1C0000000
1616 ret float %R
1717 }
1818
1919 double %test4() {
20 %R = rem double 312.20213123, 12.3333412
20 %R = rem double 0x4073833BEE07AFF8, 0x4028AAABB2A0D19C
2121 ret double %R
2222 }
44 %X = constant int 42
55 %X2 = constant int 47
66 %Y = constant [2 x { int, float }] [ { int, float } { int 12, float 1.0 },
7 { int, float } { int 37, float 1.2312 } ]
7 { int, float } { int 37, float 0x3FF3B2FEC0000000 } ]
88 %Z = constant [2 x { int, float }] zeroinitializer
99
1010 int %test1() {
44
55 @X = constant i212 42
66 @Y = constant [2 x { i212, float }] [ { i212, float } { i212 12, float 1.0 },
7 { i212, float } { i212 37, float 1.2312 } ]
7 { i212, float } { i212 37, float 0x3FF3B2FEC0000000 } ]
88 define i212 @test1() {
99 %B = load i212* @X
1010 ret i212 %B
44
55 %X = constant int 42
66 %Y = constant [2 x { int, float }] [ { int, float } { int 12, float 1.0 },
7 { int, float } { int 37, float 1.2312 } ]
7 { int, float } { int 37, float 0x3FF3B2FEC0000000 } ]
88 int %test1() {
99 %B = load int* %X
1010 ret int %B