brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 80990b4 Raw
141 lines · c
1// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s2 3typedef char cx5x5 __attribute__((matrix_type(5, 5)));4typedef int ix5x5 __attribute__((matrix_type(5, 5)));5typedef short sx5x5 __attribute__((matrix_type(5, 5)));6typedef float fx5x5 __attribute__((matrix_type(5, 5)));7typedef double dx5x5 __attribute__((matrix_type(5, 5)));8typedef unsigned short unsigned_short_int_5x5 __attribute__((matrix_type(5, 5)));9typedef unsigned int unsigned_int_5x5 __attribute__((matrix_type(5, 5)));10typedef unsigned long unsigned_long_int_5x5 __attribute__((matrix_type(5, 5)));11 12void cast_char_matrix_to_int(cx5x5 c, ix5x5 i) {13  // CHECK-LABEL: define{{.*}} void @cast_char_matrix_to_int(<25 x i8> noundef %c, <25 x i32> noundef %i)14  // CHECK:       [[C:%.*]] = load <25 x i8>, ptr {{.*}}, align 115  // CHECK-NEXT:  [[CONV:%.*]] = sext <25 x i8> [[C]] to <25 x i32>16  // CHECK-NEXT:  store <25 x i32> [[CONV]], ptr {{.*}}, align 417  // CHECK-NEXT:  ret void18 19  i = (ix5x5)c;20}21 22void cast_char_matrix_to_unsigned_int(cx5x5 c, unsigned_int_5x5 u) {23  // CHECK-LABEL: define{{.*}} void @cast_char_matrix_to_unsigned_int(<25 x i8> noundef %c, <25 x i32> noundef %u)24  // CHECK:       [[C:%.*]] = load <25 x i8>, ptr {{.*}}, align 125  // CHECK-NEXT:  [[CONV:%.*]] = sext <25 x i8> [[C]] to <25 x i32>26  // CHECK-NEXT:  store <25 x i32> [[CONV]], ptr {{.*}}, align 427  // CHECK-NEXT:  ret void28 29  u = (unsigned_int_5x5)c;30}31 32void cast_unsigned_long_int_matrix_to_short(unsigned_long_int_5x5 u, sx5x5 s) {33  // CHECK-LABEL: define{{.*}} void @cast_unsigned_long_int_matrix_to_short(<25 x i64> noundef %u, <25 x i16> noundef %s)34  // CHECK:       [[U:%.*]] = load <25 x i64>, ptr {{.*}}, align 835  // CHECK-NEXT:  [[CONV:%.*]] = trunc <25 x i64> [[U]] to <25 x i16>36  // CHECK-NEXT:  store <25 x i16> [[CONV]], ptr {{.*}}, align 237  // CHECK-NEXT:  ret void38 39  s = (sx5x5)u;40}41 42void cast_int_matrix_to_short(ix5x5 i, sx5x5 s) {43  // CHECK-LABEL: define{{.*}} void @cast_int_matrix_to_short(<25 x i32> noundef %i, <25 x i16> noundef %s)44  // CHECK:       [[I:%.*]] = load <25 x i32>, ptr {{.*}}, align 445  // CHECK-NEXT:  [[CONV:%.*]] = trunc <25 x i32> [[I]] to <25 x i16>46  // CHECK-NEXT:  store <25 x i16> [[CONV]], ptr {{.*}}, align 247  // CHECK-NEXT:  ret void48 49  s = (sx5x5)i;50}51 52void cast_int_matrix_to_float(ix5x5 i, fx5x5 f) {53  // CHECK-LABEL: define{{.*}} void @cast_int_matrix_to_float(<25 x i32> noundef %i, <25 x float> noundef %f)54  // CHECK:       [[I:%.*]] = load <25 x i32>, ptr {{.*}}, align 455  // CHECK-NEXT:  [[CONV:%.*]] = sitofp <25 x i32> [[I]] to <25 x float>56  // CHECK-NEXT:  store <25 x float> [[CONV]], ptr {{.*}}, align 457  // CHECK-NEXT:  ret void58 59  f = (fx5x5)i;60}61 62void cast_unsigned_int_matrix_to_float(unsigned_short_int_5x5 u, fx5x5 f) {63  // CHECK-LABEL: define{{.*}} void @cast_unsigned_int_matrix_to_float(<25 x i16> noundef %u, <25 x float> noundef %f)64  // CHECK:       [[U:%.*]] = load <25 x i16>, ptr {{.*}}, align 265  // CHECK-NEXT:  [[CONV:%.*]] = uitofp <25 x i16> [[U]] to <25 x float>66  // CHECK-NEXT:  store <25 x float> [[CONV]], ptr {{.*}}, align 467  // CHECK-NEXT:  ret void68 69  f = (fx5x5)u;70}71 72void cast_double_matrix_to_int(dx5x5 d, ix5x5 i) {73  // CHECK-LABEL: define{{.*}} void @cast_double_matrix_to_int(<25 x double> noundef %d, <25 x i32> noundef %i)74  // CHECK:       [[D:%.*]] = load <25 x double>, ptr {{.*}}, align 875  // CHECK-NEXT:  [[CONV:%.*]] = fptosi <25 x double> [[D]] to <25 x i32>76  // CHECK-NEXT:  store <25 x i32> [[CONV]], ptr {{.*}}, align 477  // CHECK-NEXT:  ret void78 79  i = (ix5x5)d;80}81 82void cast_float_matrix_to_unsigned_short_int(fx5x5 f, unsigned_short_int_5x5 i) {83  // CHECK-LABEL: define{{.*}} void @cast_float_matrix_to_unsigned_short_int(<25 x float> noundef %f, <25 x i16> noundef %i)84  // CHECK:       [[F:%.*]] = load <25 x float>, ptr {{.*}}, align 485  // CHECK-NEXT:  [[CONV:%.*]] = fptoui <25 x float> [[F]] to <25 x i16>86  // CHECK-NEXT:  store <25 x i16> [[CONV]], ptr %i.addr, align 287  // CHECK-NEXT:  ret void88 89  i = (unsigned_short_int_5x5)f;90}91 92void cast_double_matrix_to_float(dx5x5 d, fx5x5 f) {93  // CHECK-LABEL: define{{.*}} void @cast_double_matrix_to_float(<25 x double> noundef %d, <25 x float> noundef %f)94  // CHECK:       [[D:%.*]] = load <25 x double>, ptr {{.*}}, align 895  // CHECK-NEXT:  [[CONV:%.*]] = fptrunc <25 x double> [[D]] to <25 x float>96  // CHECK-NEXT:  store <25 x float> [[CONV]], ptr {{.*}}, align 497  // CHECK-NEXT:  ret void98 99  f = (fx5x5)d;100}101 102void cast_unsigned_short_int_to_unsigned_int(unsigned_short_int_5x5 s, unsigned_int_5x5 i) {103  // CHECK-LABEL: define{{.*}} void @cast_unsigned_short_int_to_unsigned_int(<25 x i16> noundef %s, <25 x i32> noundef %i)104  // CHECK:       [[S:%.*]] = load <25 x i16>, ptr {{.*}}, align 2105  // CHECK-NEXT:  [[CONV:%.*]] = zext <25 x i16> [[S]] to <25 x i32>106  // CHECK-NEXT:  store <25 x i32> [[CONV]], ptr {{.*}}, align 4107  // CHECK-NEXT:  ret void108 109  i = (unsigned_int_5x5)s;110}111 112void cast_unsigned_long_int_to_unsigned_short_int(unsigned_long_int_5x5 l, unsigned_short_int_5x5 s) {113  // CHECK-LABEL: define{{.*}} void @cast_unsigned_long_int_to_unsigned_short_int(<25 x i64> noundef %l, <25 x i16> noundef %s)114  // CHECK:       [[L:%.*]] = load <25 x i64>, ptr %l.addr, align 8115  // CHECK-NEXT:  [[CONV:%.*]] = trunc <25 x i64> [[L]] to <25 x i16>116  // CHECK-NEXT:  store <25 x i16> [[CONV]], ptr {{.*}}, align 2117  // CHECK-NEXT:  ret void118 119  s = (unsigned_short_int_5x5)l;120}121 122void cast_unsigned_short_int_to_int(unsigned_short_int_5x5 u, ix5x5 i) {123  // CHECK-LABEL: define{{.*}} void @cast_unsigned_short_int_to_int(<25 x i16> noundef %u, <25 x i32> noundef %i)124  // CHECK:       [[U:%.*]] = load <25 x i16>, ptr %u.addr, align 2125  // CHECK-NEXT:  [[CONV:%.*]] = zext <25 x i16> [[U]] to <25 x i32>126  // CHECK-NEXT:  store <25 x i32> [[CONV]], ptr {{.*}}, align 4127  // CHECK-NEXT:  ret void128 129  i = (ix5x5)u;130}131 132void cast_int_to_unsigned_long_int(ix5x5 i, unsigned_long_int_5x5 u) {133  // CHECK-LABEL: define{{.*}} void @cast_int_to_unsigned_long_int(<25 x i32> noundef %i, <25 x i64> noundef %u)134  // CHECK:       [[I:%.*]] = load <25 x i32>, ptr %i.addr, align 4135  // CHECK-NEXT:  [[CONV:%.*]] = sext <25 x i32> [[I]] to <25 x i64>136  // CHECK-NEXT:  store <25 x i64> [[CONV]], ptr {{.*}}, align 8137  // CHECK-NEXT:  ret void138 139  u = (unsigned_long_int_5x5)i;140}141