brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · 889486e Raw
124 lines · c
1// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,SIGNED2// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - -fpadding-on-unsigned-fixed-point | FileCheck %s --check-prefixes=CHECK,UNSIGNED3 4// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,SIGNED5// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - -fpadding-on-unsigned-fixed-point -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,UNSIGNED6 7// Between different fixed point types8short _Accum sa_const = 2.5hk;9// CHECK-DAG: @sa_const  = {{.*}}global i16 320, align 210_Accum a_const = 2.5hk;11// CHECK-DAG: @a_const   = {{.*}}global i32 81920, align 412short _Accum sa_const2 = 2.5k;13// CHECK-DAG: @sa_const2 = {{.*}}global i16 320, align 214 15short _Accum sa_from_f_const = 0.5r;16// CHECK-DAG: sa_from_f_const = {{.*}}global i16 64, align 217_Fract f_from_sa_const = 0.5hk;18// CHECK-DAG: f_from_sa_const = {{.*}}global i16 16384, align 219 20unsigned short _Accum usa_const = 2.5uk;21unsigned _Accum ua_const = 2.5uhk;22// SIGNED-DAG: @usa_const  = {{.*}}global i16 640, align 223// SIGNED-DAG: @ua_const   = {{.*}}global i32 163840, align 424// UNSIGNED-DAG:    @usa_const  = {{.*}}global i16 320, align 225// UNSIGNED-DAG:    @ua_const   = {{.*}}global i32 81920, align 426 27// FixedPoint to integer28int i_const = -128.0hk;29// CHECK-DAG: @i_const  = {{.*}}global i32 -128, align 430int i_const2 = 128.0hk;31// CHECK-DAG: @i_const2 = {{.*}}global i32 128, align 432int i_const3 = -128.0k;33// CHECK-DAG: @i_const3 = {{.*}}global i32 -128, align 434int i_const4 = 128.0k;35// CHECK-DAG: @i_const4 = {{.*}}global i32 128, align 436short s_const = -128.0k;37// CHECK-DAG: @s_const  = {{.*}}global i16 -128, align 238short s_const2 = 128.0k;39// CHECK-DAG: @s_const2 = {{.*}}global i16 128, align 240 41// Integer to fixed point42short _Accum sa_const5 = 2;43// CHECK-DAG: @sa_const5 = {{.*}}global i16 256, align 244short _Accum sa_const6 = -2;45// CHECK-DAG: @sa_const6 = {{.*}}global i16 -256, align 246short _Accum sa_const7 = -256;47// CHECK-DAG: @sa_const7 = {{.*}}global i16 -32768, align 248 49// Fixed point to floating point50float fl_const = 1.0hk;51// CHECK-DAG: @fl_const = {{.*}}global float 1.000000e+00, align 452float fl_const2 = -128.0k;53// CHECK-DAG: @fl_const2 = {{.*}}global float -1.280000e+02, align 454float fl_const3 = 0.0872802734375k;55// CHECK-DAG: @fl_const3 = {{.*}}global float 0x3FB6580000000000, align 456float fl_const4 = 192.5k;57// CHECK-DAG: @fl_const4 = {{.*}}global float 1.925000e+02, align 458float fl_const5 = -192.5k;59// CHECK-DAG: @fl_const5 = {{.*}}global float -1.925000e+02, align 460 61// Floating point to fixed point62_Accum a_fl_const = 1.0f;63// CHECK-DAG: @a_fl_const = {{.*}}global i32 32768, align 464_Accum a_fl_const2 = -128.0f;65// CHECK-DAG: @a_fl_const2 = {{.*}}global i32 -4194304, align 466_Accum a_fl_const3 = 0.0872802734375f;67// CHECK-DAG: @a_fl_const3 = {{.*}}global i32 2860, align 468_Accum a_fl_const4 = 0.0872802734375;69// CHECK-DAG: @a_fl_const4 = {{.*}}global i32 2860, align 470_Accum a_fl_const5 = -0.0872802734375f;71// CHECK-DAG: @a_fl_const5 = {{.*}}global i32 -2860, align 472_Fract f_fl_const = 0.5f;73// CHECK-DAG: @f_fl_const = {{.*}}global i16 16384, align 274_Fract f_fl_const2 = -0.75;75// CHECK-DAG: @f_fl_const2 = {{.*}}global i16 -24576, align 276unsigned short _Accum usa_fl_const = 48.75f;77// SIGNED-DAG: @usa_fl_const = {{.*}}global i16 12480, align 278// UNSIGNED-DAG: @usa_fl_const = {{.*}}global i16 6240, align 279 80// Signedness81unsigned short _Accum usa_const2 = 2.5hk;82// SIGNED-DAG: @usa_const2  = {{.*}}global i16 640, align 283// UNSIGNED-DAG:    @usa_const2  = {{.*}}global i16 320, align 284short _Accum sa_const3 = 2.5hk;85// CHECK-DAG: @sa_const3 = {{.*}}global i16 320, align 286 87int i_const5 = 128.0uhk;88unsigned int ui_const = 128.0hk;89// CHECK-DAG: @i_const5  = {{.*}}global i32 128, align 490// CHECK-DAG: @ui_const  = {{.*}}global i32 128, align 491 92short _Accum sa_const9 = 2u;93// CHECK-DAG: @sa_const9 = {{.*}}global i16 256, align 294unsigned short _Accum usa_const3 = 2;95// SIGNED-DAG: @usa_const3 = {{.*}}global i16 512, align 296// UNSIGNED-DAG:    @usa_const3 = {{.*}}global i16 256, align 297 98// Overflow (this is undefined but allowed)99short _Accum sa_const4 = 256.0k;100unsigned int ui_const2 = -2.5hk;101short _Accum sa_const8 = 256;102unsigned short _Accum usa_const4 = -2;103 104// Saturation105_Sat short _Accum sat_sa_const = 2.5hk;106// CHECK-DAG: @sat_sa_const  = {{.*}}global i16 320, align 2107_Sat short _Accum sat_sa_const2 = 256.0k;108// CHECK-DAG: @sat_sa_const2 = {{.*}}global i16 32767, align 2109_Sat unsigned short _Accum sat_usa_const = -1.0hk;110// CHECK-DAG: @sat_usa_const = {{.*}}global i16 0, align 2111_Sat unsigned short _Accum sat_usa_const2 = 256.0k;112// SIGNED-DAG: @sat_usa_const2 = {{.*}}global i16 -1, align 2113// UNSIGNED-DAG:    @sat_usa_const2 = {{.*}}global i16 32767, align 2114 115_Sat short _Accum sat_sa_const3 = 256;116// CHECK-DAG: @sat_sa_const3 = {{.*}}global i16 32767, align 2117_Sat short _Accum sat_sa_const4 = -257;118// CHECK-DAG: @sat_sa_const4 = {{.*}}global i16 -32768, align 2119_Sat unsigned short _Accum sat_usa_const3 = -1;120// CHECK-DAG: @sat_usa_const3 = {{.*}}global i16 0, align 2121_Sat unsigned short _Accum sat_usa_const4 = 256;122// SIGNED-DAG: @sat_usa_const4 = {{.*}}global i16 -1, align 2123// UNSIGNED-DAG:    @sat_usa_const4 = {{.*}}global i16 32767, align 2124