| 1 |
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \ |
| 2 |
// RUN: -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s |
| 3 |
|
| 4 |
volatile vector float ff, ff2; |
| 5 |
volatile vector bool int bi; |
| 6 |
|
| 7 |
void test_assign (void) |
| 8 |
{ |
| 9 |
// CHECK-LABEL: test_assign |
| 10 |
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 11 |
// CHECK: store volatile <4 x float> [[VAL]], ptr @ff |
| 12 |
ff = ff2; |
| 13 |
} |
| 14 |
|
| 15 |
void test_pos (void) |
| 16 |
{ |
| 17 |
// CHECK-LABEL: test_pos |
| 18 |
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 19 |
// CHECK: store volatile <4 x float> [[VAL]], ptr @ff |
| 20 |
ff = +ff2; |
| 21 |
} |
| 22 |
|
| 23 |
void test_neg (void) |
| 24 |
{ |
| 25 |
// CHECK-LABEL: test_neg |
| 26 |
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 27 |
// CHECK: %{{.*}} = fneg <4 x float> [[VAL]] |
| 28 |
ff = -ff2; |
| 29 |
} |
| 30 |
|
| 31 |
void test_preinc (void) |
| 32 |
{ |
| 33 |
// CHECK-LABEL: test_preinc |
| 34 |
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 35 |
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00> |
| 36 |
++ff2; |
| 37 |
} |
| 38 |
|
| 39 |
void test_postinc (void) |
| 40 |
{ |
| 41 |
// CHECK-LABEL: test_postinc |
| 42 |
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 43 |
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00> |
| 44 |
ff2++; |
| 45 |
} |
| 46 |
|
| 47 |
void test_predec (void) |
| 48 |
{ |
| 49 |
// CHECK-LABEL: test_predec |
| 50 |
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 51 |
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00> |
| 52 |
--ff2; |
| 53 |
} |
| 54 |
|
| 55 |
void test_postdec (void) |
| 56 |
{ |
| 57 |
// CHECK-LABEL: test_postdec |
| 58 |
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 59 |
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00> |
| 60 |
ff2--; |
| 61 |
} |
| 62 |
|
| 63 |
void test_add (void) |
| 64 |
{ |
| 65 |
// CHECK-LABEL: test_add |
| 66 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 67 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 68 |
// CHECK: %{{.*}} = fadd <4 x float> [[VAL1]], [[VAL2]] |
| 69 |
ff = ff + ff2; |
| 70 |
} |
| 71 |
|
| 72 |
void test_add_assign (void) |
| 73 |
{ |
| 74 |
// CHECK-LABEL: test_add_assign |
| 75 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 76 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 77 |
// CHECK: %{{.*}} = fadd <4 x float> [[VAL2]], [[VAL1]] |
| 78 |
ff += ff2; |
| 79 |
} |
| 80 |
|
| 81 |
void test_sub (void) |
| 82 |
{ |
| 83 |
// CHECK-LABEL: test_sub |
| 84 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 85 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 86 |
// CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]] |
| 87 |
ff = ff - ff2; |
| 88 |
} |
| 89 |
|
| 90 |
void test_sub_assign (void) |
| 91 |
{ |
| 92 |
// CHECK-LABEL: test_sub_assign |
| 93 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 94 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 95 |
// CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]] |
| 96 |
ff -= ff2; |
| 97 |
} |
| 98 |
|
| 99 |
void test_mul (void) |
| 100 |
{ |
| 101 |
// CHECK-LABEL: test_mul |
| 102 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 103 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 104 |
// CHECK: %{{.*}} = fmul <4 x float> [[VAL1]], [[VAL2]] |
| 105 |
ff = ff * ff2; |
| 106 |
} |
| 107 |
|
| 108 |
void test_mul_assign (void) |
| 109 |
{ |
| 110 |
// CHECK-LABEL: test_mul_assign |
| 111 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 112 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 113 |
// CHECK: %{{.*}} = fmul <4 x float> [[VAL2]], [[VAL1]] |
| 114 |
ff *= ff2; |
| 115 |
} |
| 116 |
|
| 117 |
void test_div (void) |
| 118 |
{ |
| 119 |
// CHECK-LABEL: test_div |
| 120 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 121 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 122 |
// CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]] |
| 123 |
ff = ff / ff2; |
| 124 |
} |
| 125 |
|
| 126 |
void test_div_assign (void) |
| 127 |
{ |
| 128 |
// CHECK-LABEL: test_div_assign |
| 129 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 130 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 131 |
// CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]] |
| 132 |
ff /= ff2; |
| 133 |
} |
| 134 |
|
| 135 |
void test_cmpeq (void) |
| 136 |
{ |
| 137 |
// CHECK-LABEL: test_cmpeq |
| 138 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 139 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 140 |
// CHECK: [[CMP:%[^ ]+]] = fcmp oeq <4 x float> [[VAL1]], [[VAL2]] |
| 141 |
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> |
| 142 |
bi = ff == ff2; |
| 143 |
} |
| 144 |
|
| 145 |
void test_cmpne (void) |
| 146 |
{ |
| 147 |
// CHECK-LABEL: test_cmpne |
| 148 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 149 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 150 |
// CHECK: [[CMP:%[^ ]+]] = fcmp une <4 x float> [[VAL1]], [[VAL2]] |
| 151 |
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> |
| 152 |
bi = ff != ff2; |
| 153 |
} |
| 154 |
|
| 155 |
void test_cmpge (void) |
| 156 |
{ |
| 157 |
// CHECK-LABEL: test_cmpge |
| 158 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 159 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 160 |
// CHECK: [[CMP:%[^ ]+]] = fcmp oge <4 x float> [[VAL1]], [[VAL2]] |
| 161 |
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> |
| 162 |
bi = ff >= ff2; |
| 163 |
} |
| 164 |
|
| 165 |
void test_cmpgt (void) |
| 166 |
{ |
| 167 |
// CHECK-LABEL: test_cmpgt |
| 168 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 169 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 170 |
// CHECK: [[CMP:%[^ ]+]] = fcmp ogt <4 x float> [[VAL1]], [[VAL2]] |
| 171 |
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> |
| 172 |
bi = ff > ff2; |
| 173 |
} |
| 174 |
|
| 175 |
void test_cmple (void) |
| 176 |
{ |
| 177 |
// CHECK-LABEL: test_cmple |
| 178 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 179 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 180 |
// CHECK: [[CMP:%[^ ]+]] = fcmp ole <4 x float> [[VAL1]], [[VAL2]] |
| 181 |
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> |
| 182 |
bi = ff <= ff2; |
| 183 |
} |
| 184 |
|
| 185 |
void test_cmplt (void) |
| 186 |
{ |
| 187 |
// CHECK-LABEL: test_cmplt |
| 188 |
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff |
| 189 |
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2 |
| 190 |
// CHECK: [[CMP:%[^ ]+]] = fcmp olt <4 x float> [[VAL1]], [[VAL2]] |
| 191 |
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> |
| 192 |
bi = ff < ff2; |
| 193 |
} |
| 194 |
|