1f4a2713aSLionel Sambuc // REQUIRES: arm-registered-target 2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s 3f4a2713aSLionel Sambuc typedef unsigned cond_t; 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambuc volatile cond_t test; 6f4a2713aSLionel Sambuc volatile __fp16 h0 = 0.0, h1 = 1.0, h2; 7f4a2713aSLionel Sambuc volatile float f0, f1, f2; 8f4a2713aSLionel Sambuc foo(void)9f4a2713aSLionel Sambucvoid foo(void) { 10f4a2713aSLionel Sambuc // CHECK-LABEL: define void @foo() 11f4a2713aSLionel Sambuc 12f4a2713aSLionel Sambuc // Check unary ops 13f4a2713aSLionel Sambuc 14*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 15f4a2713aSLionel Sambuc // CHECK fptoi float 16f4a2713aSLionel Sambuc test = (h0); 17*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 18f4a2713aSLionel Sambuc // CHECK: fcmp une float 19f4a2713aSLionel Sambuc test = (!h1); 20*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 21f4a2713aSLionel Sambuc // CHECK: fsub float 22*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 23f4a2713aSLionel Sambuc h1 = -h1; 24*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 25*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 26f4a2713aSLionel Sambuc h1 = +h1; 27*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 28f4a2713aSLionel Sambuc // CHECK: fadd float 29*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 30f4a2713aSLionel Sambuc h1++; 31*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 32f4a2713aSLionel Sambuc // CHECK: fadd float 33*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 34f4a2713aSLionel Sambuc ++h1; 35*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 36f4a2713aSLionel Sambuc // CHECK: fadd float 37*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 38f4a2713aSLionel Sambuc --h1; 39*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 40f4a2713aSLionel Sambuc // CHECK: fadd float 41*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 42f4a2713aSLionel Sambuc h1--; 43f4a2713aSLionel Sambuc 44f4a2713aSLionel Sambuc // Check binary ops with various operands 45*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 46*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 47f4a2713aSLionel Sambuc // CHECK: fmul float 48*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 49f4a2713aSLionel Sambuc h1 = h0 * h2; 50*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 51*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 52*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 53f4a2713aSLionel Sambuc // CHECK: fmul float 54*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 55f4a2713aSLionel Sambuc h1 = h0 * (__fp16) -2.0; 56*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 57f4a2713aSLionel Sambuc // CHECK: fmul float 58*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 59f4a2713aSLionel Sambuc h1 = h0 * f2; 60*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 61f4a2713aSLionel Sambuc // CHECK: fmul float 62*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 63f4a2713aSLionel Sambuc h1 = f0 * h2; 64f4a2713aSLionel Sambuc 65*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 66*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 67f4a2713aSLionel Sambuc // CHECK: fdiv float 68*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 69f4a2713aSLionel Sambuc h1 = (h0 / h2); 70*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 71*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 72f4a2713aSLionel Sambuc // CHECK: fdiv float 73*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 74f4a2713aSLionel Sambuc h1 = (h0 / (__fp16) -2.0); 75*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 76f4a2713aSLionel Sambuc // CHECK: fdiv float 77*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 78f4a2713aSLionel Sambuc h1 = (h0 / f2); 79*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 80f4a2713aSLionel Sambuc // CHECK: fdiv float 81*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 82f4a2713aSLionel Sambuc h1 = (f0 / h2); 83f4a2713aSLionel Sambuc 84*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 85*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 86f4a2713aSLionel Sambuc // CHECK: fadd float 87*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 88f4a2713aSLionel Sambuc h1 = (h2 + h0); 89*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 90*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 91f4a2713aSLionel Sambuc // CHECK: fadd float 92*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 93f4a2713aSLionel Sambuc h1 = ((__fp16)-2.0 + h0); 94*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 95f4a2713aSLionel Sambuc // CHECK: fadd float 96*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 97f4a2713aSLionel Sambuc h1 = (h2 + f0); 98*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 99f4a2713aSLionel Sambuc // CHECK: fadd float 100*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 101f4a2713aSLionel Sambuc h1 = (f2 + h0); 102f4a2713aSLionel Sambuc 103*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 104*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 105f4a2713aSLionel Sambuc // CHECK: fsub float 106*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 107f4a2713aSLionel Sambuc h1 = (h2 - h0); 108*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 109*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 110f4a2713aSLionel Sambuc // CHECK: fsub float 111*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 112f4a2713aSLionel Sambuc h1 = ((__fp16)-2.0 - h0); 113*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 114f4a2713aSLionel Sambuc // CHECK: fsub float 115*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 116f4a2713aSLionel Sambuc h1 = (h2 - f0); 117*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 118f4a2713aSLionel Sambuc // CHECK: fsub float 119*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 120f4a2713aSLionel Sambuc h1 = (f2 - h0); 121f4a2713aSLionel Sambuc 122*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 123*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 124f4a2713aSLionel Sambuc // CHECK: fcmp olt 125f4a2713aSLionel Sambuc test = (h2 < h0); 126*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 127*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 128f4a2713aSLionel Sambuc // CHECK: fcmp olt 129f4a2713aSLionel Sambuc test = (h2 < (__fp16)42.0); 130*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 131f4a2713aSLionel Sambuc // CHECK: fcmp olt 132f4a2713aSLionel Sambuc test = (h2 < f0); 133*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 134f4a2713aSLionel Sambuc // CHECK: fcmp olt 135f4a2713aSLionel Sambuc test = (f2 < h0); 136f4a2713aSLionel Sambuc 137*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 138*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 139f4a2713aSLionel Sambuc // CHECK: fcmp ogt 140f4a2713aSLionel Sambuc test = (h0 > h2); 141*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 142*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 143f4a2713aSLionel Sambuc // CHECK: fcmp ogt 144f4a2713aSLionel Sambuc test = ((__fp16)42.0 > h2); 145*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 146f4a2713aSLionel Sambuc // CHECK: fcmp ogt 147f4a2713aSLionel Sambuc test = (h0 > f2); 148*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 149f4a2713aSLionel Sambuc // CHECK: fcmp ogt 150f4a2713aSLionel Sambuc test = (f0 > h2); 151f4a2713aSLionel Sambuc 152*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 153*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 154f4a2713aSLionel Sambuc // CHECK: fcmp ole 155f4a2713aSLionel Sambuc test = (h2 <= h0); 156*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 157*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 158f4a2713aSLionel Sambuc // CHECK: fcmp ole 159f4a2713aSLionel Sambuc test = (h2 <= (__fp16)42.0); 160*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 161f4a2713aSLionel Sambuc // CHECK: fcmp ole 162f4a2713aSLionel Sambuc test = (h2 <= f0); 163*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 164f4a2713aSLionel Sambuc // CHECK: fcmp ole 165f4a2713aSLionel Sambuc test = (f2 <= h0); 166f4a2713aSLionel Sambuc 167*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 168*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 169f4a2713aSLionel Sambuc // CHECK: fcmp oge 170f4a2713aSLionel Sambuc test = (h0 >= h2); 171*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 172*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 173f4a2713aSLionel Sambuc // CHECK: fcmp oge 174f4a2713aSLionel Sambuc test = (h0 >= (__fp16)-2.0); 175*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 176f4a2713aSLionel Sambuc // CHECK: fcmp oge 177f4a2713aSLionel Sambuc test = (h0 >= f2); 178*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 179f4a2713aSLionel Sambuc // CHECK: fcmp oge 180f4a2713aSLionel Sambuc test = (f0 >= h2); 181f4a2713aSLionel Sambuc 182*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 183*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 184f4a2713aSLionel Sambuc // CHECK: fcmp oeq 185f4a2713aSLionel Sambuc test = (h1 == h2); 186*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 187*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 188f4a2713aSLionel Sambuc // CHECK: fcmp oeq 189f4a2713aSLionel Sambuc test = (h1 == (__fp16)1.0); 190*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 191f4a2713aSLionel Sambuc // CHECK: fcmp oeq 192f4a2713aSLionel Sambuc test = (h1 == f1); 193*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 194f4a2713aSLionel Sambuc // CHECK: fcmp oeq 195f4a2713aSLionel Sambuc test = (f1 == h1); 196f4a2713aSLionel Sambuc 197*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 198*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 199f4a2713aSLionel Sambuc // CHECK: fcmp une 200f4a2713aSLionel Sambuc test = (h1 != h2); 201*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 202*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 203f4a2713aSLionel Sambuc // CHECK: fcmp une 204f4a2713aSLionel Sambuc test = (h1 != (__fp16)1.0); 205*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 206f4a2713aSLionel Sambuc // CHECK: fcmp une 207f4a2713aSLionel Sambuc test = (h1 != f1); 208*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 209f4a2713aSLionel Sambuc // CHECK: fcmp une 210f4a2713aSLionel Sambuc test = (f1 != h1); 211f4a2713aSLionel Sambuc 212*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 213f4a2713aSLionel Sambuc // CHECK: fcmp une 214*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 215*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 216*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 217f4a2713aSLionel Sambuc h1 = (h1 ? h2 : h0); 218f4a2713aSLionel Sambuc // Check assignments (inc. compound) 219f4a2713aSLionel Sambuc h0 = h1; 220*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 221f4a2713aSLionel Sambuc h0 = (__fp16)-2.0; 222*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 223f4a2713aSLionel Sambuc h0 = f0; 224f4a2713aSLionel Sambuc 225*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 226*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 227f4a2713aSLionel Sambuc // CHECK: fadd float 228*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 229f4a2713aSLionel Sambuc h0 += h1; 230*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 231*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 232f4a2713aSLionel Sambuc // CHECK: fadd 233*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 234f4a2713aSLionel Sambuc h0 += (__fp16)1.0; 235*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 236f4a2713aSLionel Sambuc // CHECK: fadd 237*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 238f4a2713aSLionel Sambuc h0 += f2; 239f4a2713aSLionel Sambuc 240*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 241*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 242f4a2713aSLionel Sambuc // CHECK: fsub 243*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 244f4a2713aSLionel Sambuc h0 -= h1; 245*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 246*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 247f4a2713aSLionel Sambuc // CHECK: fsub 248*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 249f4a2713aSLionel Sambuc h0 -= (__fp16)1.0; 250*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 251f4a2713aSLionel Sambuc // CHECK: fsub 252*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 253f4a2713aSLionel Sambuc h0 -= f2; 254f4a2713aSLionel Sambuc 255*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 256*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 257f4a2713aSLionel Sambuc // CHECK: fmul 258*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 259f4a2713aSLionel Sambuc h0 *= h1; 260*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 261*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 262f4a2713aSLionel Sambuc // CHECK: fmul 263*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 264f4a2713aSLionel Sambuc h0 *= (__fp16)1.0; 265*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 266f4a2713aSLionel Sambuc // CHECK: fmul 267*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 268f4a2713aSLionel Sambuc h0 *= f2; 269f4a2713aSLionel Sambuc 270*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 271*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 272f4a2713aSLionel Sambuc // CHECK: fdiv 273*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 274f4a2713aSLionel Sambuc h0 /= h1; 275*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 276*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 277f4a2713aSLionel Sambuc // CHECK: fdiv 278*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 279f4a2713aSLionel Sambuc h0 /= (__fp16)1.0; 280*0a6a1f1dSLionel Sambuc // CHECK: call float @llvm.convert.from.fp16.f32( 281f4a2713aSLionel Sambuc // CHECK: fdiv 282*0a6a1f1dSLionel Sambuc // CHECK: call i16 @llvm.convert.to.fp16.f32( 283f4a2713aSLionel Sambuc h0 /= f2; 284f4a2713aSLionel Sambuc } 285