1 ; Trivial smoke test of bitcast between integer and FP types. 2 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s 4 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s 5 6 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=obj --disassemble \ 7 ; RUN: --target arm32 -i %s --args -O2 \ 8 ; RUN: | %if --need=target_ARM32 --command FileCheck %s \ 9 ; RUN: --check-prefix=ARM32 10 11 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=obj --disassemble \ 12 ; RUN: --target arm32 -i %s --args -Om1 \ 13 ; RUN: | %if --need=target_ARM32 --command FileCheck %s \ 14 ; RUN: --check-prefix=ARM32 15 16 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ 17 ; RUN: --command %p2i --filetype=asm \ 18 ; RUN: --target mips32 -i %s --args -O2 \ 19 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ 20 ; RUN: --command FileCheck %s \ 21 ; RUN: --check-prefix=MIPS32 --check-prefix=MIPS32-O2 22 23 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ 24 ; RUN: --command %p2i --filetype=asm \ 25 ; RUN: --target mips32 -i %s --args -Om1 \ 26 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ 27 ; RUN: --command FileCheck %s \ 28 ; RUN: --check-prefix=MIPS32 --check-prefix=MIPS32-OM1 29 30 define internal i32 @cast_f2i(float %f) { 31 entry: 32 %v0 = bitcast float %f to i32 33 ret i32 %v0 34 } 35 ; CHECK-LABEL: cast_f2i 36 ; CHECK: movd eax 37 ; ARM32-LABEL: cast_f2i 38 ; ARM32: vmov r{{[0-9]+}}, s{{[0-9]+}} 39 ; MIPS32-LABEL: cast_f2i 40 ; MIPS32-O2: mfc1 $v0, $f{{[0-9]+}} 41 ; MIPS32-OM1: swc1 42 ; MIPS32-OM1: lw 43 44 define internal float @cast_i2f(i32 %i) { 45 entry: 46 %v0 = bitcast i32 %i to float 47 ret float %v0 48 } 49 ; CHECK-LABEL: cast_i2f 50 ; CHECK: fld DWORD PTR 51 ; ARM32-LABEL: cast_i2f 52 ; ARM32: vmov s{{[0-9]+}}, r{{[0-9]+}} 53 ; MIPS32-LABEL: cast_i2f 54 ; MIPS32-O2: mtc1 $a0, $f{{[0-9]+}} 55 ; MIPS32-OM1: sw 56 ; MIPS32-OM1: lwc1 57 58 define internal i64 @cast_d2ll(double %d) { 59 entry: 60 %v0 = bitcast double %d to i64 61 ret i64 %v0 62 } 63 ; CHECK-LABEL: cast_d2ll 64 ; CHECK: mov edx 65 ; ARM32-LABEL: cast_d2ll 66 ; ARM32: vmov r{{[0-9]+}}, r{{[0-9]+}}, d{{[0-9]+}} 67 ; MIPS32-LABEL: cast_d2ll 68 ; MIPS32-O2: swc1 $f13, {{.*}} 69 ; MIPS32-O2: swc1 $f12, {{.*}} 70 ; MIPS32-O2: lw $v0, {{.*}} 71 ; MIPS32-O2: lw $v1, {{.*}} 72 ; MIPS32-OM1: sdc1 73 ; MIPS32-OM1: lw 74 ; MIPS32-OM1: lw 75 76 define internal i64 @cast_d2ll_const() { 77 entry: 78 %v0 = bitcast double 0x12345678901234 to i64 79 ret i64 %v0 80 } 81 ; CHECK-LABEL: cast_d2ll_const 82 ; CHECK: mov e{{..}},{{(DWORD PTR )?}}ds:0x0 {{.*}} {{.*}}0012345678901234 83 ; CHECK: mov e{{..}},{{(DWORD PTR )?}}ds:0x4 {{.*}} {{.*}}0012345678901234 84 ; ARM32-LABEL: cast_d2ll_const 85 ; ARM32-DAG: movw [[ADDR:r[0-9]+]], #{{.*_MOVW_}} 86 ; ARM32-DAG: movt [[ADDR]], #{{.*_MOVT_}} 87 ; ARM32-DAG: vldr [[DREG:d[0-9]+]], {{\[}}[[ADDR]]{{\]}} 88 ; ARM32: vmov r{{[0-9]+}}, r{{[0-9]+}}, [[DREG]] 89 ; MIPS32-LABEL: cast_d2ll_const 90 ; MIPS32: lui {{.*}}, %hi(.L$double$0012345678901234) 91 ; MIPS32: ldc1 {{.*}}, %lo(.L$double$0012345678901234)({{.*}}) 92 ; MIPS32: swc1 $f{{[0-9]+}}, {{.*}} 93 ; MIPS32: swc1 $f{{[0-9]+}}, {{.*}} 94 ; MIPS32: lw $v0, {{.*}} 95 ; MIPS32: lw $v1, {{.*}} 96 97 define internal double @cast_ll2d(i64 %ll) { 98 entry: 99 %v0 = bitcast i64 %ll to double 100 ret double %v0 101 } 102 ; CHECK-LABEL: cast_ll2d 103 ; CHECK: fld QWORD PTR 104 ; ARM32-LABEL: cast_ll2d 105 ; ARM32: vmov d{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} 106 ; MIPS32-LABEL: cast_ll2d 107 ; MIPS32-O2: mtc1 $a0, $f{{[0-9]+}} 108 ; MIPS32-O2: mtc1 $a1, $f{{[0-9]+}} 109 ; MIPS32-OM1: sw 110 ; MIPS32-OM1: sw 111 ; MIPS32-OM1: ldc1 112 113 define internal double @cast_ll2d_const() { 114 entry: 115 %v0 = bitcast i64 12345678901234 to double 116 ret double %v0 117 } 118 ; CHECK-LABEL: cast_ll2d_const 119 ; CHECK: mov {{.*}},0x73ce2ff2 120 ; CHECK: mov {{.*}},0xb3a 121 ; CHECK: fld QWORD PTR 122 ; ARM32-LABEL: cast_ll2d_const 123 ; ARM32-DAG: movw [[REG0:r[0-9]+]], #12274 124 ; ARM32-DAG: movt [[REG0:r[0-9]+]], #29646 125 ; ARM32-DAG: movw [[REG1:r[0-9]+]], #2874 126 ; ARM32: vmov d{{[0-9]+}}, [[REG0]], [[REG1]] 127 ; MIPS32-LABEL: cast_ll2d_const 128 ; MIPS32: lui {{.*}}, 29646 129 ; MIPS32: ori {{.*}}, {{.*}}, 12274 130 ; MIPS32: addiu {{.*}}, $zero, 2874 131 ; MIPS32-O2: mtc1 {{.*}}, $f{{[0-9]+}} 132 ; MIPS32-O2: mtc1 {{.*}}, $f{{[0-9]+}} 133 ; MIPS32-OM1: sw 134 ; MIPS32-OM1: sw 135 ; MIPS32-OM1: ldc1 136