OLD | NEW |
---|---|
1 ; This tests that different floating point constants (such as 0.0 and -0.0) | 1 ; This tests that different floating point constants (such as 0.0 and -0.0) |
2 ; remain distinct even when they sort of look equal, and also that different | 2 ; remain distinct even when they sort of look equal, and also that different |
3 ; instances of the same floating point constant (such as NaN and NaN) get the | 3 ; instances of the same floating point constant (such as NaN and NaN) get the |
4 ; same constant pool entry even when "a==a" would suggest they are different. | 4 ; same constant pool entry even when "a==a" would suggest they are different. |
5 | 5 |
6 ; REQUIRES: allow_dump | 6 ; REQUIRES: allow_dump |
7 | 7 |
8 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ | |
9 ; RUN: --command %p2i --filetype=asm --assemble --disassemble \ | |
10 ; RUN: --target mips32 -i %s --args -O2 --skip-unimplemented \ | |
11 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ | |
12 ; RUN: --command FileCheck --check-prefix MIPS32 %s | |
13 | |
8 define internal void @consume_float(float %f) { | 14 define internal void @consume_float(float %f) { |
9 ret void | 15 ret void |
10 } | 16 } |
11 | 17 |
12 define internal void @consume_double(double %d) { | 18 define internal void @consume_double(double %d) { |
13 ret void | 19 ret void |
14 } | 20 } |
15 | 21 |
16 define internal void @test_zeros() { | 22 define internal void @test_zeros() { |
17 entry: | 23 entry: |
18 call void @consume_float(float 0.0) | 24 call void @consume_float(float 0.0) |
19 call void @consume_float(float -0.0) | 25 call void @consume_float(float -0.0) |
20 call void @consume_double(double 0.0) | 26 call void @consume_double(double 0.0) |
21 call void @consume_double(double -0.0) | 27 call void @consume_double(double -0.0) |
22 ret void | 28 ret void |
23 } | 29 } |
30 | |
31 ; MIPS32-LABEL: test_zeros | |
32 ; MIPS32: mtc1 zero,[[REG:.*]] | |
33 ; MIPS32: mov.s {{.*}},[[REG]] | |
34 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$80000000 | |
Jim Stichnoth
2016/09/20 15:37:45
This is OK for now, but I want to point out that t
jaydeep.patil
2016/09/21 04:52:33
Acknowledged.
| |
35 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$80000000 | |
36 ; MIPS32: mtc1 zero,[[REGLo:.*]] | |
37 ; MIPS32: mtc1 zero,[[REGHi:.*]] | |
38 ; MIPS32: mov.d {{.*}},[[REGLo]] | |
39 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$8000000000000000 | |
40 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$8000000000000000 | |
41 | |
24 ; Parse the function, dump the bitcode back out, and stop without translating. | 42 ; Parse the function, dump the bitcode back out, and stop without translating. |
25 ; This tests that +0.0 and -0.0 aren't accidentally merged into a single | 43 ; This tests that +0.0 and -0.0 aren't accidentally merged into a single |
26 ; zero-valued constant pool entry. | 44 ; zero-valued constant pool entry. |
27 ; | 45 ; |
28 ; RUN: %p2i -i %s --insts | FileCheck --check-prefix=ZERO %s | 46 ; RUN: %p2i -i %s --insts | FileCheck --check-prefix=ZERO %s |
29 ; ZERO: test_zeros | 47 ; ZERO: test_zeros |
30 ; ZERO-NEXT: entry: | 48 ; ZERO-NEXT: entry: |
31 ; ZERO-NEXT: call void @consume_float(float 0.0 | 49 ; ZERO-NEXT: call void @consume_float(float 0.0 |
32 ; ZERO-NEXT: call void @consume_float(float -0.0 | 50 ; ZERO-NEXT: call void @consume_float(float -0.0 |
33 ; ZERO-NEXT: call void @consume_double(double 0.0 | 51 ; ZERO-NEXT: call void @consume_double(double 0.0 |
34 ; ZERO-NEXT: call void @consume_double(double -0.0 | 52 ; ZERO-NEXT: call void @consume_double(double -0.0 |
35 | 53 |
36 | 54 |
37 define internal void @test_nans() { | 55 define internal void @test_nans() { |
38 entry: | 56 entry: |
39 call void @consume_float(float 0x7FF8000000000000) | 57 call void @consume_float(float 0x7FF8000000000000) |
40 call void @consume_float(float 0x7FF8000000000000) | 58 call void @consume_float(float 0x7FF8000000000000) |
41 call void @consume_float(float 0xFFF8000000000000) | 59 call void @consume_float(float 0xFFF8000000000000) |
42 call void @consume_float(float 0xFFF8000000000000) | 60 call void @consume_float(float 0xFFF8000000000000) |
43 call void @consume_double(double 0x7FF8000000000000) | 61 call void @consume_double(double 0x7FF8000000000000) |
44 call void @consume_double(double 0x7FF8000000000000) | 62 call void @consume_double(double 0x7FF8000000000000) |
45 call void @consume_double(double 0xFFF8000000000000) | 63 call void @consume_double(double 0xFFF8000000000000) |
46 call void @consume_double(double 0xFFF8000000000000) | 64 call void @consume_double(double 0xFFF8000000000000) |
47 ret void | 65 ret void |
48 } | 66 } |
67 | |
68 ; MIPS32-LABEL: test_nans | |
69 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$7fc00000 | |
70 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$7fc00000 | |
71 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$7fc00000 | |
72 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$7fc00000 | |
73 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$ffc00000 | |
74 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$ffc00000 | |
75 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$ffc00000 | |
76 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$ffc00000 | |
77 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$7ff8000000000000 | |
78 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$7ff8000000000000 | |
79 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$7ff8000000000000 | |
80 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$7ff8000000000000 | |
81 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$fff8000000000000 | |
82 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$fff8000000000000 | |
83 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$fff8000000000000 | |
84 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$fff8000000000000 | |
85 ; MIPS32: jr ra | |
86 | |
49 ; The following tests check the emitted constant pool entries and make sure | 87 ; The following tests check the emitted constant pool entries and make sure |
50 ; there is at most one entry for each NaN value. We have to run a separate test | 88 ; there is at most one entry for each NaN value. We have to run a separate test |
51 ; for each NaN because the constant pool entries may be emitted in any order. | 89 ; for each NaN because the constant pool entries may be emitted in any order. |
52 ; | 90 ; |
53 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 91 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
54 ; RUN: | FileCheck --check-prefix=NANS1 %s | 92 ; RUN: | FileCheck --check-prefix=NANS1 %s |
55 ; NANS1: float nan | 93 ; NANS1: float nan |
56 ; NANS1-NOT: float nan | 94 ; NANS1-NOT: float nan |
57 ; | 95 ; |
58 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 96 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
59 ; RUN: | FileCheck --check-prefix=NANS2 %s | 97 ; RUN: | FileCheck --check-prefix=NANS2 %s |
60 ; NANS2: float -nan | 98 ; NANS2: float -nan |
61 ; NANS2-NOT: float -nan | 99 ; NANS2-NOT: float -nan |
62 ; | 100 ; |
63 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 101 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
64 ; RUN: | FileCheck --check-prefix=NANS3 %s | 102 ; RUN: | FileCheck --check-prefix=NANS3 %s |
65 ; NANS3: double nan | 103 ; NANS3: double nan |
66 ; NANS3-NOT: double nan | 104 ; NANS3-NOT: double nan |
67 ; | 105 ; |
68 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 106 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
69 ; RUN: | FileCheck --check-prefix=NANS4 %s | 107 ; RUN: | FileCheck --check-prefix=NANS4 %s |
70 ; NANS4: double -nan | 108 ; NANS4: double -nan |
71 ; NANS4-NOT: double -nan | 109 ; NANS4-NOT: double -nan |
110 | |
111 ; MIPS32 constant pool | |
112 ; RUN: %if --need=target_MIPS32 --command %p2i \ | |
113 ; RUN: --target mips32 -i %s --filetype=asm --llvm-source \ | |
114 ; RUN: --args -O2 --skip-unimplemented \ | |
115 ; RUN: | %if --need=target_MIPS32 --command FileCheck \ | |
116 ; RUN: --check-prefix=MIPS32CP %s | |
117 ; MIPS32CP-LABEL: .L$float$7fc00000: | |
118 ; MIPS32CP: .word 0x7fc00000 /* f32 nan */ | |
Jim Stichnoth
2016/09/20 15:37:45
Similar comment as above. The "/* f32 nan */" par
jaydeep.patil
2016/09/21 04:52:33
Acknowledged.
| |
119 ; MIPS32CP-LABEL: .L$float$80000000 | |
120 ; MIPS32CP: .word 0x80000000 /* f32 -0.000000e+00 */ | |
121 ; MIPS32CP-LABEL: .L$float$ffc00000 | |
122 ; MIPS32CP: .word 0xffc00000 /* f32 -nan */ | |
123 ; MIPS32CP-LABEL: .L$double$7ff8000000000000 | |
124 ; MIPS32CP: .quad 0x7ff8000000000000 /* f64 nan */ | |
125 ; MIPS32CP-LABEL: .L$double$8000000000000000 | |
126 ; MIPS32CP: .quad 0x8000000000000000 /* f64 -0.000000e+00 */ | |
127 ; MIPS32CP-LABEL: .L$double$fff8000000000000 | |
128 ; MIPS32CP: .quad 0xfff8000000000000 /* f64 -nan */ | |
OLD | NEW |