|
1 | 1 | // REQUIRES: x86-registered-target
|
2 |
| -// RUN: %clang -S -emit-llvm -ffp-model=fast -emit-llvm %s -o - \ |
| 2 | +// RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=fast %s -o - \ |
3 | 3 | // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-FAST
|
4 | 4 |
|
5 |
| -// RUN: %clang -S -emit-llvm -ffp-model=precise %s -o - \ |
| 5 | +// RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=precise %s -o - \ |
6 | 6 | // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-PRECISE
|
7 | 7 |
|
8 |
| -// RUN: %clang -S -emit-llvm -ffp-model=strict %s -o - \ |
| 8 | +// RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=strict %s -o - \ |
9 | 9 | // RUN: -target x86_64 | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT
|
10 | 10 |
|
11 |
| -// RUN: %clang -S -emit-llvm -ffp-model=strict -ffast-math \ |
| 11 | +// RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=strict -ffast-math \ |
12 | 12 | // RUN: -target x86_64 %s -o - | FileCheck %s \
|
13 | 13 | // RUN: --check-prefixes CHECK,CHECK-STRICT-FAST
|
14 | 14 |
|
15 |
| -// RUN: %clang -S -emit-llvm -ffp-model=precise -ffast-math \ |
| 15 | +// RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=precise -ffast-math \ |
16 | 16 | // RUN: %s -o - | FileCheck %s --check-prefixes CHECK,CHECK-FAST1
|
17 | 17 |
|
18 | 18 | float mymuladd(float x, float y, float z) {
|
@@ -46,3 +46,105 @@ float mymuladd(float x, float y, float z) {
|
46 | 46 | // CHECK-FAST1: load float, ptr {{.*}}
|
47 | 47 | // CHECK-FAST1: fadd fast float {{.*}}, {{.*}}
|
48 | 48 | }
|
| 49 | + |
| 50 | +typedef float __attribute__((ext_vector_type(2))) v2f; |
| 51 | + |
| 52 | +v2f my_vec_muladd(v2f x, float y, v2f z) { |
| 53 | + // CHECK: define{{.*}} @my_vec_muladd |
| 54 | + return x * y + z; |
| 55 | + |
| 56 | + // CHECK-FAST: fmul fast <2 x float> |
| 57 | + // CHECK-FAST: load <2 x float>, ptr |
| 58 | + // CHECK-FAST: fadd fast <2 x float> |
| 59 | + |
| 60 | + // CHECK-PRECISE: load <2 x float>, ptr |
| 61 | + // CHECK-PRECISE: load float, ptr |
| 62 | + // CHECK-PRECISE: load <2 x float>, ptr |
| 63 | + // CHECK-PRECISE: call <2 x float> @llvm.fmuladd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, <2 x float> {{.*}}) |
| 64 | + |
| 65 | + // CHECK-STRICT: load <2 x float>, ptr |
| 66 | + // CHECK-STRICT: load float, ptr |
| 67 | + // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fmul.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}}) |
| 68 | + // CHECK-STRICT: load <2 x float>, ptr |
| 69 | + // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}}) |
| 70 | + |
| 71 | + // CHECK-STRICT-FAST: load <2 x float>, ptr |
| 72 | + // CHECK-STRICT-FAST: load float, ptr |
| 73 | + // CHECK-STRICT-FAST: fmul fast <2 x float> {{.*}}, {{.*}} |
| 74 | + // CHECK-STRICT-FAST: load <2 x float>, ptr |
| 75 | + // CHECK-STRICT-FAST: fadd fast <2 x float> {{.*}}, {{.*}} |
| 76 | + |
| 77 | + // CHECK-FAST1: load <2 x float>, ptr |
| 78 | + // CHECK-FAST1: load float, ptr |
| 79 | + // CHECK-FAST1: fmul fast <2 x float> {{.*}}, {{.*}} |
| 80 | + // CHECK-FAST1: load <2 x float>, ptr {{.*}} |
| 81 | + // CHECK-FAST1: fadd fast <2 x float> {{.*}}, {{.*}} |
| 82 | +} |
| 83 | + |
| 84 | +typedef float __attribute__((matrix_type(2, 1))) m21f; |
| 85 | + |
| 86 | +m21f my_m21_muladd(m21f x, float y, m21f z) { |
| 87 | + // CHECK: define{{.*}} <2 x float> @my_m21_muladd |
| 88 | + return x * y + z; |
| 89 | + |
| 90 | + // CHECK-FAST: fmul fast <2 x float> |
| 91 | + // CHECK-FAST: load <2 x float>, ptr |
| 92 | + // CHECK-FAST: fadd fast <2 x float> |
| 93 | + |
| 94 | + // CHECK-PRECISE: load <2 x float>, ptr |
| 95 | + // CHECK-PRECISE: load float, ptr |
| 96 | + // CHECK-PRECISE: load <2 x float>, ptr |
| 97 | + // CHECK-PRECISE: call <2 x float> @llvm.fmuladd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, <2 x float> {{.*}}) |
| 98 | + |
| 99 | + // CHECK-STRICT: load <2 x float>, ptr |
| 100 | + // CHECK-STRICT: load float, ptr |
| 101 | + // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fmul.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}}) |
| 102 | + // CHECK-STRICT: load <2 x float>, ptr |
| 103 | + // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}}) |
| 104 | + |
| 105 | + // CHECK-STRICT-FAST: load <2 x float>, ptr |
| 106 | + // CHECK-STRICT-FAST: load float, ptr |
| 107 | + // CHECK-STRICT-FAST: fmul fast <2 x float> {{.*}}, {{.*}} |
| 108 | + // CHECK-STRICT-FAST: load <2 x float>, ptr |
| 109 | + // CHECK-STRICT-FAST: fadd fast <2 x float> {{.*}}, {{.*}} |
| 110 | + |
| 111 | + // CHECK-FAST1: load <2 x float>, ptr |
| 112 | + // CHECK-FAST1: load float, ptr |
| 113 | + // CHECK-FAST1: fmul fast <2 x float> {{.*}}, {{.*}} |
| 114 | + // CHECK-FAST1: load <2 x float>, ptr {{.*}} |
| 115 | + // CHECK-FAST1: fadd fast <2 x float> {{.*}}, {{.*}} |
| 116 | +} |
| 117 | + |
| 118 | +typedef float __attribute__((matrix_type(2, 2))) m22f; |
| 119 | + |
| 120 | +m22f my_m22_muladd(m22f x, float y, m22f z) { |
| 121 | + // CHECK: define{{.*}} <4 x float> @my_m22_muladd |
| 122 | + return x * y + z; |
| 123 | + |
| 124 | + // CHECK-FAST: fmul fast <4 x float> |
| 125 | + // CHECK-FAST: load <4 x float>, ptr |
| 126 | + // CHECK-FAST: fadd fast <4 x float> |
| 127 | + |
| 128 | + // CHECK-PRECISE: load <4 x float>, ptr |
| 129 | + // CHECK-PRECISE: load float, ptr |
| 130 | + // CHECK-PRECISE: load <4 x float>, ptr |
| 131 | + // CHECK-PRECISE: call <4 x float> @llvm.fmuladd.v4f32(<4 x float> {{.*}}, <4 x float> {{.*}}, <4 x float> {{.*}}) |
| 132 | + |
| 133 | + // CHECK-STRICT: load <4 x float>, ptr |
| 134 | + // CHECK-STRICT: load float, ptr |
| 135 | + // CHECK-STRICT: call <4 x float> @llvm.experimental.constrained.fmul.v4f32(<4 x float> {{.*}}, <4 x float> {{.*}}, {{.*}}) |
| 136 | + // CHECK-STRICT: load <4 x float>, ptr |
| 137 | + // CHECK-STRICT: call <4 x float> @llvm.experimental.constrained.fadd.v4f32(<4 x float> {{.*}}, <4 x float> {{.*}}, {{.*}}) |
| 138 | + |
| 139 | + // CHECK-STRICT-FAST: load <4 x float>, ptr |
| 140 | + // CHECK-STRICT-FAST: load float, ptr |
| 141 | + // CHECK-STRICT-FAST: fmul fast <4 x float> {{.*}}, {{.*}} |
| 142 | + // CHECK-STRICT-FAST: load <4 x float>, ptr |
| 143 | + // CHECK-STRICT-FAST: fadd fast <4 x float> {{.*}}, {{.*}} |
| 144 | + |
| 145 | + // CHECK-FAST1: load <4 x float>, ptr |
| 146 | + // CHECK-FAST1: load float, ptr |
| 147 | + // CHECK-FAST1: fmul fast <4 x float> {{.*}}, {{.*}} |
| 148 | + // CHECK-FAST1: load <4 x float>, ptr {{.*}} |
| 149 | + // CHECK-FAST1: fadd fast <4 x float> {{.*}}, {{.*}} |
| 150 | +} |
0 commit comments