1 // RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,SIGNED 2 // RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -fpadding-on-unsigned-fixed-point -S -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,UNSIGNED 3 4 short _Accum sa_const1 = 1.0hk << 2; 5 // CHECK-DAG: @sa_const1 = {{.*}}global i16 512 6 short _Accum sa_const2 = 0.5hk << 2; 7 // CHECK-DAG: @sa_const2 = {{.*}}global i16 256 8 short _Accum sa_const3 = 10.0hk >> 3; 9 // CHECK-DAG: @sa_const3 = {{.*}}global i16 160 10 short _Accum sa_const4 = 0.0546875hk << 8; 11 // CHECK-DAG: @sa_const4 = {{.*}}global i16 1792 12 short _Accum sa_const5 = -1.0hk << 2; 13 // CHECK-DAG: @sa_const5 = {{.*}}global i16 -512 14 short _Accum sa_const6 = -255.0hk >> 8; 15 // CHECK-DAG: @sa_const6 = {{.*}}global i16 -128 16 17 _Fract f_const1 = -1.0r >> 5; 18 // CHECK-DAG: @f_const1 = {{.*}}global i16 -1024 19 _Fract f_const2 = 0.0052490234375r >> 3; 20 // CHECK-DAG: @f_const2 = {{.*}}global i16 21 21 _Fract f_const3 = -0.0001r << 5; 22 // CHECK-DAG: @f_const3 = {{.*}}global i16 -96 23 _Fract f_const4 = -0.75r >> 15; 24 // CHECK-DAG: @f_const4 = {{.*}}global i16 -1 25 _Fract f_const5 = 0.078216552734375r << 3; 26 // CHECK-DAG: @f_const5 = {{.*}}global i16 20504 27 28 unsigned _Fract uf_const1 = 0.375ur >> 13; 29 // SIGNED-DAG: @uf_const1 = {{.*}}global i16 3 30 // UNSIGNED-DAG: @uf_const1 = {{.*}}global i16 1 31 unsigned _Fract uf_const2 = 0.0546875ur << 3; 32 // SIGNED-DAG: @uf_const2 = {{.*}}global i16 28672 33 // UNSIGNED-DAG: @uf_const2 = {{.*}}global i16 14336 34 35 _Sat short _Accum ssa_const1 = (_Sat short _Accum)31.875hk << 4; 36 // CHECK-DAG: @ssa_const1 = {{.*}}global i16 32767 37 _Sat short _Accum ssa_const2 = (_Sat short _Accum) - 1.0hk << 8; 38 // CHECK-DAG: @ssa_const2 = {{.*}}global i16 -32768 39 _Sat short _Accum ssa_const3 = (_Sat short _Accum)128.0hk << 8; 40 // CHECK-DAG: @ssa_const3 = {{.*}}global i16 32767 41 _Sat short _Fract ssf_const1 = (_Sat short _Fract) - 0.5hr << 3; 42 // CHECK-DAG: @ssf_const1 = {{.*}}global i8 -128 43 44 _Sat unsigned _Fract suf_const1 = (_Sat unsigned _Fract)0.5r << 1; 45 // SIGNED-DAG: @suf_const1 = {{.*}}global i16 -1 46 // UNSIGNED-DAG: @suf_const1 = {{.*}}global i16 32767 47 _Sat unsigned _Fract suf_const2 = (_Sat unsigned _Fract)0.25r << 1; 48 // SIGNED-DAG: @suf_const2 = {{.*}}global i16 -32768 49 // UNSIGNED-DAG: @suf_const2 = {{.*}}global i16 16384 50 _Sat unsigned _Accum sua_const2 = (_Sat unsigned _Accum)128.0uk << 10; 51 // SIGNED-DAG: @sua_const2 = {{.*}}global i32 -1 52 // UNSIGNED-DAG: @sua_const2 = {{.*}}global i32 2147483647 53