1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -O0 | FileCheck %s 2 3 @var32 = global i32 0 4 @var64 = global i64 0 5 6 define void @test_fcvtzs(float %flt, double %dbl) { 7 ; CHECK-LABEL: test_fcvtzs: 8 9 %fix1 = fmul float %flt, 128.0 10 %cvt1 = fptosi float %fix1 to i32 11 ; CHECK: fcvtzs {{w[0-9]+}}, {{s[0-9]+}}, #7 12 store volatile i32 %cvt1, i32* @var32 13 14 %fix2 = fmul float %flt, 4294967296.0 15 %cvt2 = fptosi float %fix2 to i32 16 ; CHECK: fcvtzs {{w[0-9]+}}, {{s[0-9]+}}, #32 17 store volatile i32 %cvt2, i32* @var32 18 19 %fix3 = fmul float %flt, 128.0 20 %cvt3 = fptosi float %fix3 to i64 21 ; CHECK: fcvtzs {{x[0-9]+}}, {{s[0-9]+}}, #7 22 store volatile i64 %cvt3, i64* @var64 23 24 %fix4 = fmul float %flt, 18446744073709551616.0 25 %cvt4 = fptosi float %fix4 to i64 26 ; CHECK: fcvtzs {{x[0-9]+}}, {{s[0-9]+}}, #64 27 store volatile i64 %cvt4, i64* @var64 28 29 %fix5 = fmul double %dbl, 128.0 30 %cvt5 = fptosi double %fix5 to i32 31 ; CHECK: fcvtzs {{w[0-9]+}}, {{d[0-9]+}}, #7 32 store volatile i32 %cvt5, i32* @var32 33 34 %fix6 = fmul double %dbl, 4294967296.0 35 %cvt6 = fptosi double %fix6 to i32 36 ; CHECK: fcvtzs {{w[0-9]+}}, {{d[0-9]+}}, #32 37 store volatile i32 %cvt6, i32* @var32 38 39 %fix7 = fmul double %dbl, 128.0 40 %cvt7 = fptosi double %fix7 to i64 41 ; CHECK: fcvtzs {{x[0-9]+}}, {{d[0-9]+}}, #7 42 store volatile i64 %cvt7, i64* @var64 43 44 %fix8 = fmul double %dbl, 18446744073709551616.0 45 %cvt8 = fptosi double %fix8 to i64 46 ; CHECK: fcvtzs {{x[0-9]+}}, {{d[0-9]+}}, #64 47 store volatile i64 %cvt8, i64* @var64 48 49 ret void 50 } 51 52 define void @test_fcvtzu(float %flt, double %dbl) { 53 ; CHECK-LABEL: test_fcvtzu: 54 55 %fix1 = fmul float %flt, 128.0 56 %cvt1 = fptoui float %fix1 to i32 57 ; CHECK: fcvtzu {{w[0-9]+}}, {{s[0-9]+}}, #7 58 store volatile i32 %cvt1, i32* @var32 59 60 %fix2 = fmul float %flt, 4294967296.0 61 %cvt2 = fptoui float %fix2 to i32 62 ; CHECK: fcvtzu {{w[0-9]+}}, {{s[0-9]+}}, #32 63 store volatile i32 %cvt2, i32* @var32 64 65 %fix3 = fmul float %flt, 128.0 66 %cvt3 = fptoui float %fix3 to i64 67 ; CHECK: fcvtzu {{x[0-9]+}}, {{s[0-9]+}}, #7 68 store volatile i64 %cvt3, i64* @var64 69 70 %fix4 = fmul float %flt, 18446744073709551616.0 71 %cvt4 = fptoui float %fix4 to i64 72 ; CHECK: fcvtzu {{x[0-9]+}}, {{s[0-9]+}}, #64 73 store volatile i64 %cvt4, i64* @var64 74 75 %fix5 = fmul double %dbl, 128.0 76 %cvt5 = fptoui double %fix5 to i32 77 ; CHECK: fcvtzu {{w[0-9]+}}, {{d[0-9]+}}, #7 78 store volatile i32 %cvt5, i32* @var32 79 80 %fix6 = fmul double %dbl, 4294967296.0 81 %cvt6 = fptoui double %fix6 to i32 82 ; CHECK: fcvtzu {{w[0-9]+}}, {{d[0-9]+}}, #32 83 store volatile i32 %cvt6, i32* @var32 84 85 %fix7 = fmul double %dbl, 128.0 86 %cvt7 = fptoui double %fix7 to i64 87 ; CHECK: fcvtzu {{x[0-9]+}}, {{d[0-9]+}}, #7 88 store volatile i64 %cvt7, i64* @var64 89 90 %fix8 = fmul double %dbl, 18446744073709551616.0 91 %cvt8 = fptoui double %fix8 to i64 92 ; CHECK: fcvtzu {{x[0-9]+}}, {{d[0-9]+}}, #64 93 store volatile i64 %cvt8, i64* @var64 94 95 ret void 96 } 97 98 @varfloat = global float 0.0 99 @vardouble = global double 0.0 100 101 define void @test_scvtf(i32 %int, i64 %long) { 102 ; CHECK-LABEL: test_scvtf: 103 104 %cvt1 = sitofp i32 %int to float 105 %fix1 = fdiv float %cvt1, 128.0 106 ; CHECK: scvtf {{s[0-9]+}}, {{w[0-9]+}}, #7 107 store volatile float %fix1, float* @varfloat 108 109 %cvt2 = sitofp i32 %int to float 110 %fix2 = fdiv float %cvt2, 4294967296.0 111 ; CHECK: scvtf {{s[0-9]+}}, {{w[0-9]+}}, #32 112 store volatile float %fix2, float* @varfloat 113 114 %cvt3 = sitofp i64 %long to float 115 %fix3 = fdiv float %cvt3, 128.0 116 ; CHECK: scvtf {{s[0-9]+}}, {{x[0-9]+}}, #7 117 store volatile float %fix3, float* @varfloat 118 119 %cvt4 = sitofp i64 %long to float 120 %fix4 = fdiv float %cvt4, 18446744073709551616.0 121 ; CHECK: scvtf {{s[0-9]+}}, {{x[0-9]+}}, #64 122 store volatile float %fix4, float* @varfloat 123 124 %cvt5 = sitofp i32 %int to double 125 %fix5 = fdiv double %cvt5, 128.0 126 ; CHECK: scvtf {{d[0-9]+}}, {{w[0-9]+}}, #7 127 store volatile double %fix5, double* @vardouble 128 129 %cvt6 = sitofp i32 %int to double 130 %fix6 = fdiv double %cvt6, 4294967296.0 131 ; CHECK: scvtf {{d[0-9]+}}, {{w[0-9]+}}, #32 132 store volatile double %fix6, double* @vardouble 133 134 %cvt7 = sitofp i64 %long to double 135 %fix7 = fdiv double %cvt7, 128.0 136 ; CHECK: scvtf {{d[0-9]+}}, {{x[0-9]+}}, #7 137 store volatile double %fix7, double* @vardouble 138 139 %cvt8 = sitofp i64 %long to double 140 %fix8 = fdiv double %cvt8, 18446744073709551616.0 141 ; CHECK: scvtf {{d[0-9]+}}, {{x[0-9]+}}, #64 142 store volatile double %fix8, double* @vardouble 143 144 ret void 145 } 146 147 define void @test_ucvtf(i32 %int, i64 %long) { 148 ; CHECK-LABEL: test_ucvtf: 149 150 %cvt1 = uitofp i32 %int to float 151 %fix1 = fdiv float %cvt1, 128.0 152 ; CHECK: ucvtf {{s[0-9]+}}, {{w[0-9]+}}, #7 153 store volatile float %fix1, float* @varfloat 154 155 %cvt2 = uitofp i32 %int to float 156 %fix2 = fdiv float %cvt2, 4294967296.0 157 ; CHECK: ucvtf {{s[0-9]+}}, {{w[0-9]+}}, #32 158 store volatile float %fix2, float* @varfloat 159 160 %cvt3 = uitofp i64 %long to float 161 %fix3 = fdiv float %cvt3, 128.0 162 ; CHECK: ucvtf {{s[0-9]+}}, {{x[0-9]+}}, #7 163 store volatile float %fix3, float* @varfloat 164 165 %cvt4 = uitofp i64 %long to float 166 %fix4 = fdiv float %cvt4, 18446744073709551616.0 167 ; CHECK: ucvtf {{s[0-9]+}}, {{x[0-9]+}}, #64 168 store volatile float %fix4, float* @varfloat 169 170 %cvt5 = uitofp i32 %int to double 171 %fix5 = fdiv double %cvt5, 128.0 172 ; CHECK: ucvtf {{d[0-9]+}}, {{w[0-9]+}}, #7 173 store volatile double %fix5, double* @vardouble 174 175 %cvt6 = uitofp i32 %int to double 176 %fix6 = fdiv double %cvt6, 4294967296.0 177 ; CHECK: ucvtf {{d[0-9]+}}, {{w[0-9]+}}, #32 178 store volatile double %fix6, double* @vardouble 179 180 %cvt7 = uitofp i64 %long to double 181 %fix7 = fdiv double %cvt7, 128.0 182 ; CHECK: ucvtf {{d[0-9]+}}, {{x[0-9]+}}, #7 183 store volatile double %fix7, double* @vardouble 184 185 %cvt8 = uitofp i64 %long to double 186 %fix8 = fdiv double %cvt8, 18446744073709551616.0 187 ; CHECK: ucvtf {{d[0-9]+}}, {{x[0-9]+}}, #64 188 store volatile double %fix8, double* @vardouble 189 190 ret void 191 } 192