[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / fp-matrix-pragma.c
blob5c9909bf60e0ff7d7b30ad811aedd6824c5b2188
1 // RUN: %clang -emit-llvm -S -fenable-matrix -mllvm -disable-llvm-optzns %s -o - | FileCheck %s
2 // UNSUPPORTED: target={{.*}}-zos{{.*}}
4 typedef float fx2x2_t __attribute__((matrix_type(2, 2)));
5 typedef int ix2x2_t __attribute__((matrix_type(2, 2)));
7 fx2x2_t fp_matrix_contract(fx2x2_t a, fx2x2_t b, float c, float d) {
8 // CHECK: call contract <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32
9 // CHECK: fdiv contract <4 x float>
10 // CHECK: fmul contract <4 x float>
11 #pragma clang fp contract(fast)
12 return (a * b / c) * d;
15 fx2x2_t fp_matrix_reassoc(fx2x2_t a, fx2x2_t b, fx2x2_t c) {
16 // CHECK: fadd reassoc <4 x float>
17 // CHECK: fsub reassoc <4 x float>
18 #pragma clang fp reassociate(on)
19 return a + b - c;
22 fx2x2_t fp_matrix_ops(fx2x2_t a, fx2x2_t b, fx2x2_t c) {
23 // CHECK: call reassoc contract <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32
24 // CHECK: fadd reassoc contract <4 x float>
25 #pragma clang fp contract(fast) reassociate(on)
26 return a * b + c;
29 fx2x2_t fp_matrix_compound_ops(fx2x2_t a, fx2x2_t b, fx2x2_t c, fx2x2_t d,
30 float e, float f) {
31 // CHECK: call reassoc contract <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32
32 // CHECK: fadd reassoc contract <4 x float>
33 // CHECK: fsub reassoc contract <4 x float>
34 // CHECK: fmul reassoc contract <4 x float>
35 // CHECK: fdiv reassoc contract <4 x float>
36 #pragma clang fp contract(fast) reassociate(on)
37 a *= b;
38 a += c;
39 a -= d;
40 a *= e;
41 a /= f;
43 return a;
46 ix2x2_t int_matrix_ops(ix2x2_t a, ix2x2_t b, ix2x2_t c) {
47 // CHECK: call <4 x i32> @llvm.matrix.multiply.v4i32.v4i32.v4i32
48 // CHECK: add <4 x i32>
49 #pragma clang fp contract(fast) reassociate(on)
50 return a * b + c;