brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · f11366a Raw
55 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 -fpadding-on-unsigned-fixed-point -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,UNSIGNED3 4// Multiplication between different fixed point types5short _Accum sa_const = 2.0hk * 2.0hk;6// CHECK-DAG: @sa_const  = {{.*}}global i16 512, align 27_Accum a_const = 3.0hk * 2.0k;8// CHECK-DAG: @a_const   = {{.*}}global i32 196608, align 49long _Accum la_const = 4.0hk * 2.0lk;10// CHECK-DAG: @la_const  = {{.*}}global i64 17179869184, align 811short _Accum sa_const2 = 0.5hr * 2.0hk;12// CHECK-DAG: @sa_const2  = {{.*}}global i16 128, align 213short _Accum sa_const3 = 0.5r * 3.0hk;14// CHECK-DAG: @sa_const3  = {{.*}}global i16 192, align 215short _Accum sa_const4 = 0.5lr * 4.0hk;16// CHECK-DAG: @sa_const4  = {{.*}}global i16 256, align 217 18// Unsigned multiplication19unsigned short _Accum usa_const = 1.0uhk * 2.0uhk;20// SIGNED-DAG:   @usa_const = {{.*}}global i16 512, align 221// UNSIGNED-DAG: @usa_const = {{.*}}global i16 256, align 222 23// Unsigned * signed24short _Accum sa_const5 = 20.0uhk * 3.0hk;25// CHECK-DAG: @sa_const5 = {{.*}}global i16 7680, align 226 27// Multiplication with negative number28short _Accum sa_const6 = 0.5hr * (-2.0hk);29// CHECK-DAG: @sa_const6 = {{.*}}global i16 -128, align 230 31// Int multiplication32unsigned short _Accum usa_const2 = 5 * 10.5uhk;33// SIGNED-DAG:   @usa_const2 = {{.*}}global i16 13440, align 234// UNSIGNED-DAG: @usa_const2 = {{.*}}global i16 6720, align 235short _Accum sa_const7 = 3 * (-0.5hk);36// CHECK-DAG: @sa_const7 = {{.*}}global i16 -192, align 237short _Accum sa_const8 = 100 * (-2.0hk);38// CHECK-DAG: @sa_const8 = {{.*}}global i16 -25600, align 239long _Fract lf_const = -0.25lr * 3;40// CHECK-DAG: @lf_const  = {{.*}}global i32 -1610612736, align 441 42// Saturated multiplication43_Sat short _Accum sat_sa_const = (_Sat short _Accum)128.0hk * 3.0hk;44// CHECK-DAG: @sat_sa_const = {{.*}}global i16 32767, align 245_Sat unsigned short _Accum sat_usa_const = (_Sat unsigned short _Accum)128.0uhk * 128.0uhk;46// SIGNED-DAG:   @sat_usa_const = {{.*}}global i16 -1, align 247// UNSIGNED-DAG: @sat_usa_const = {{.*}}global i16 32767, align 248_Sat short _Accum sat_sa_const2 = (_Sat short _Accum)128.0hk * -128;49// CHECK-DAG: @sat_sa_const2 = {{.*}}global i16 -32768, align 250_Sat unsigned short _Accum sat_usa_const2 = (_Sat unsigned short _Accum)128.0uhk * 30;51// SIGNED-DAG:   @sat_usa_const2 = {{.*}}global i16 -1, align 252// UNSIGNED-DAG: @sat_usa_const2 = {{.*}}global i16 32767, align 253_Sat unsigned short _Accum sat_usa_const3 = (_Sat unsigned short _Accum)0.5uhk * (-2);54// CHECK-DAG:   @sat_usa_const3 = {{.*}}global i16 0, align 255