| OLD | NEW |
| (Empty) | |
| 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 |
| 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. |
| 5 |
| 6 ; REQUIRES: allow_dump |
| 7 |
| 8 define void @consume_float(float %f) { |
| 9 ret void |
| 10 } |
| 11 |
| 12 define void @consume_double(double %d) { |
| 13 ret void |
| 14 } |
| 15 |
| 16 define void @test_zeros() { |
| 17 entry: |
| 18 call void @consume_float(float 0.0) |
| 19 call void @consume_float(float -0.0) |
| 20 call void @consume_double(double 0.0) |
| 21 call void @consume_double(double -0.0) |
| 22 ret void |
| 23 } |
| 24 ; 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 |
| 26 ; zero-valued constant pool entry. |
| 27 ; |
| 28 ; RUN: %p2i -i %s --insts | FileCheck --check-prefix=ZERO %s |
| 29 ; ZERO: test_zeros |
| 30 ; ZERO-NEXT: entry: |
| 31 ; ZERO-NEXT: call void @consume_float(float 0.0 |
| 32 ; ZERO-NEXT: call void @consume_float(float -0.0 |
| 33 ; ZERO-NEXT: call void @consume_double(double 0.0 |
| 34 ; ZERO-NEXT: call void @consume_double(double -0.0 |
| 35 |
| 36 |
| 37 define void @test_nans() { |
| 38 entry: |
| 39 call void @consume_float(float 0x7FF8000000000000) |
| 40 call void @consume_float(float 0x7FF8000000000000) |
| 41 call void @consume_float(float 0xFFF8000000000000) |
| 42 call void @consume_float(float 0xFFF8000000000000) |
| 43 call void @consume_double(double 0x7FF8000000000000) |
| 44 call void @consume_double(double 0x7FF8000000000000) |
| 45 call void @consume_double(double 0xFFF8000000000000) |
| 46 call void @consume_double(double 0xFFF8000000000000) |
| 47 ret void |
| 48 } |
| 49 ; 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 |
| 51 ; for each NaN because the constant pool entries may be emitted in any order. |
| 52 ; |
| 53 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
| 54 ; RUN: | FileCheck --check-prefix=NANS1 %s |
| 55 ; NANS1: float nan |
| 56 ; NANS1-NOT: float nan |
| 57 ; |
| 58 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
| 59 ; RUN: | FileCheck --check-prefix=NANS2 %s |
| 60 ; NANS2: float -nan |
| 61 ; NANS2-NOT: float -nan |
| 62 ; |
| 63 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
| 64 ; RUN: | FileCheck --check-prefix=NANS3 %s |
| 65 ; NANS3: double nan |
| 66 ; NANS3-NOT: double nan |
| 67 ; |
| 68 ; RUN: %p2i -i %s --filetype=asm --llvm-source \ |
| 69 ; RUN: | FileCheck --check-prefix=NANS4 %s |
| 70 ; NANS4: double -nan |
| 71 ; NANS4-NOT: double -nan |
| OLD | NEW |