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: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$00000000 |
| 33 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$00000000 |
| 34 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$80000000 |
| 35 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$80000000 |
| 36 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$0000000000000000 |
| 37 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$0000000000000000 |
| 38 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$8000000000000000 |
| 39 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$8000000000000000 |
| 40 |
24 ; Parse the function, dump the bitcode back out, and stop without translating. | 41 ; 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 | 42 ; This tests that +0.0 and -0.0 aren't accidentally merged into a single |
26 ; zero-valued constant pool entry. | 43 ; zero-valued constant pool entry. |
27 ; | 44 ; |
28 ; RUN: %p2i -i %s --insts | FileCheck --check-prefix=ZERO %s | 45 ; RUN: %p2i -i %s --insts | FileCheck --check-prefix=ZERO %s |
29 ; ZERO: test_zeros | 46 ; ZERO: test_zeros |
30 ; ZERO-NEXT: entry: | 47 ; ZERO-NEXT: entry: |
31 ; ZERO-NEXT: call void @consume_float(float 0.0 | 48 ; ZERO-NEXT: call void @consume_float(float 0.0 |
32 ; ZERO-NEXT: call void @consume_float(float -0.0 | 49 ; ZERO-NEXT: call void @consume_float(float -0.0 |
33 ; ZERO-NEXT: call void @consume_double(double 0.0 | 50 ; ZERO-NEXT: call void @consume_double(double 0.0 |
34 ; ZERO-NEXT: call void @consume_double(double -0.0 | 51 ; ZERO-NEXT: call void @consume_double(double -0.0 |
35 | 52 |
36 | 53 |
37 define internal void @test_nans() { | 54 define internal void @test_nans() { |
38 entry: | 55 entry: |
39 call void @consume_float(float 0x7FF8000000000000) | 56 call void @consume_float(float 0x7FF8000000000000) |
40 call void @consume_float(float 0x7FF8000000000000) | 57 call void @consume_float(float 0x7FF8000000000000) |
41 call void @consume_float(float 0xFFF8000000000000) | 58 call void @consume_float(float 0xFFF8000000000000) |
42 call void @consume_float(float 0xFFF8000000000000) | 59 call void @consume_float(float 0xFFF8000000000000) |
43 call void @consume_double(double 0x7FF8000000000000) | 60 call void @consume_double(double 0x7FF8000000000000) |
44 call void @consume_double(double 0x7FF8000000000000) | 61 call void @consume_double(double 0x7FF8000000000000) |
45 call void @consume_double(double 0xFFF8000000000000) | 62 call void @consume_double(double 0xFFF8000000000000) |
46 call void @consume_double(double 0xFFF8000000000000) | 63 call void @consume_double(double 0xFFF8000000000000) |
47 ret void | 64 ret void |
48 } | 65 } |
| 66 |
| 67 ; MIPS32-LABEL: test_nans |
| 68 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$7fc00000 |
| 69 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$7fc00000 |
| 70 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$7fc00000 |
| 71 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$7fc00000 |
| 72 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$ffc00000 |
| 73 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$ffc00000 |
| 74 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$float$ffc00000 |
| 75 ; MIPS32: lwc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$float$ffc00000 |
| 76 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$7ff8000000000000 |
| 77 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$7ff8000000000000 |
| 78 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$7ff8000000000000 |
| 79 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$7ff8000000000000 |
| 80 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$fff8000000000000 |
| 81 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$fff8000000000000 |
| 82 ; MIPS32: lui [[REG:.*]],{{.*}}: R_MIPS_HI16 .L$double$fff8000000000000 |
| 83 ; MIPS32: ldc1 {{.*}},0([[REG]]) {{.*}}: R_MIPS_LO16 .L$double$fff8000000000000 |
| 84 ; MIPS32: jr ra |
| 85 |
49 ; The following tests check the emitted constant pool entries and make sure | 86 ; 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 | 87 ; 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. | 88 ; for each NaN because the constant pool entries may be emitted in any order. |
52 ; | 89 ; |
53 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 90 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
54 ; RUN: | FileCheck --check-prefix=NANS1 %s | 91 ; RUN: | FileCheck --check-prefix=NANS1 %s |
55 ; NANS1: float nan | 92 ; NANS1: float nan |
56 ; NANS1-NOT: float nan | 93 ; NANS1-NOT: float nan |
57 ; | 94 ; |
58 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 95 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
59 ; RUN: | FileCheck --check-prefix=NANS2 %s | 96 ; RUN: | FileCheck --check-prefix=NANS2 %s |
60 ; NANS2: float -nan | 97 ; NANS2: float -nan |
61 ; NANS2-NOT: float -nan | 98 ; NANS2-NOT: float -nan |
62 ; | 99 ; |
63 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 100 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
64 ; RUN: | FileCheck --check-prefix=NANS3 %s | 101 ; RUN: | FileCheck --check-prefix=NANS3 %s |
65 ; NANS3: double nan | 102 ; NANS3: double nan |
66 ; NANS3-NOT: double nan | 103 ; NANS3-NOT: double nan |
67 ; | 104 ; |
68 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ | 105 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
69 ; RUN: | FileCheck --check-prefix=NANS4 %s | 106 ; RUN: | FileCheck --check-prefix=NANS4 %s |
70 ; NANS4: double -nan | 107 ; NANS4: double -nan |
71 ; NANS4-NOT: double -nan | 108 ; NANS4-NOT: double -nan |
| 109 |
| 110 ; MIPS32 constant pool |
| 111 ; RUN: %if --need=target_MIPS32 --command %p2i \ |
| 112 ; RUN: --target mips32 -i %s --filetype=asm --llvm-source \ |
| 113 ; RUN: --args -O2 --skip-unimplemented \ |
| 114 ; RUN: | %if --need=target_MIPS32 --command FileCheck \ |
| 115 ; RUN: --check-prefix=MIPS32CP %s |
| 116 ; MIPS32CP-LABEL: .L$float$00000000 |
| 117 ; MIPS32CP: .word 0x0 /* f32 0.000000e+00 */ |
| 118 ; MIPS32CP-LABEL: .L$float$7fc00000: |
| 119 ; MIPS32CP: .word 0x7fc00000 /* f32 nan */ |
| 120 ; MIPS32CP-LABEL: .L$float$80000000 |
| 121 ; MIPS32CP: .word 0x80000000 /* f32 -0.000000e+00 */ |
| 122 ; MIPS32CP-LABEL: .L$float$ffc00000 |
| 123 ; MIPS32CP: .word 0xffc00000 /* f32 -nan */ |
| 124 ; MIPS32CP-LABEL: .L$double$0000000000000000 |
| 125 ; MIPS32CP: .word 0x0 |
| 126 ; MIPS32CP: .word 0x0 /* f64 0.000000e+00 */ |
| 127 ; MIPS32CP-LABEL: .L$double$7ff8000000000000 |
| 128 ; MIPS32CP: .word 0x7ff80000 |
| 129 ; MIPS32CP: .word 0x0 /* f64 nan */ |
| 130 ; MIPS32CP-LABEL: .L$double$8000000000000000 |
| 131 ; MIPS32CP: .word 0x80000000 |
| 132 ; MIPS32CP: .word 0x0 /* f64 -0.000000e+00 */ |
| 133 ; MIPS32CP-LABEL: .L$double$fff8000000000000 |
| 134 ; MIPS32CP: .word 0xfff80000 |
| 135 ; MIPS32CP: .word 0x0 /* f64 -nan */ |
OLD | NEW |