|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | +; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s |
| 3 | + |
| 4 | +define void @select_2x2_bot(i1 %cond, ptr %lhs, ptr %rhs, ptr %out) { |
| 5 | +; CHECK-LABEL: @select_2x2_bot( |
| 6 | +; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x float>, ptr [[LHS:%.*]], align 16 |
| 7 | +; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[LHS]], i64 2 |
| 8 | +; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <2 x float>, ptr [[VEC_GEP]], align 8 |
| 9 | +; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <2 x float>, ptr [[RHS:%.*]], align 16 |
| 10 | +; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr float, ptr [[RHS]], i64 2 |
| 11 | +; CHECK-NEXT: [[COL_LOAD4:%.*]] = load <2 x float>, ptr [[VEC_GEP3]], align 8 |
| 12 | +; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[COND:%.*]], <2 x float> [[COL_LOAD]], <2 x float> [[COL_LOAD2]] |
| 13 | +; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[COND]], <2 x float> [[COL_LOAD1]], <2 x float> [[COL_LOAD4]] |
| 14 | +; CHECK-NEXT: store <2 x float> [[TMP1]], ptr [[OUT:%.*]], align 4 |
| 15 | +; CHECK-NEXT: [[VEC_GEP5:%.*]] = getelementptr float, ptr [[OUT]], i64 2 |
| 16 | +; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[VEC_GEP5]], align 4 |
| 17 | +; CHECK-NEXT: ret void |
| 18 | +; |
| 19 | + %lhsv = load <4 x float>, ptr %lhs |
| 20 | + %rhsv = load <4 x float>, ptr %rhs |
| 21 | + %op = select i1 %cond, <4 x float> %lhsv, <4 x float> %rhsv |
| 22 | + call void @llvm.matrix.column.major.store(<4 x float> %op, ptr %out, i64 2, i1 false, i32 2, i32 2) |
| 23 | + ret void |
| 24 | +} |
| 25 | + |
| 26 | +define void @select_2x2_lhs(i1 %cond, ptr %lhs, ptr %rhs, ptr %out) { |
| 27 | +; CHECK-LABEL: @select_2x2_lhs( |
| 28 | +; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x float>, ptr [[LHS:%.*]], align 4 |
| 29 | +; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[LHS]], i64 2 |
| 30 | +; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <2 x float>, ptr [[VEC_GEP]], align 4 |
| 31 | +; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <2 x float>, ptr [[RHS:%.*]], align 16 |
| 32 | +; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr float, ptr [[RHS]], i64 2 |
| 33 | +; CHECK-NEXT: [[COL_LOAD4:%.*]] = load <2 x float>, ptr [[VEC_GEP3]], align 8 |
| 34 | +; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[COND:%.*]], <2 x float> [[COL_LOAD]], <2 x float> [[COL_LOAD2]] |
| 35 | +; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[COND]], <2 x float> [[COL_LOAD1]], <2 x float> [[COL_LOAD4]] |
| 36 | +; CHECK-NEXT: store <2 x float> [[TMP1]], ptr [[OUT:%.*]], align 16 |
| 37 | +; CHECK-NEXT: [[VEC_GEP5:%.*]] = getelementptr float, ptr [[OUT]], i64 2 |
| 38 | +; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[VEC_GEP5]], align 8 |
| 39 | +; CHECK-NEXT: ret void |
| 40 | +; |
| 41 | + %lhsv = call <4 x float> @llvm.matrix.column.major.load(ptr %lhs, i64 2, i1 false, i32 2, i32 2) |
| 42 | + %rhsv = load <4 x float>, ptr %rhs |
| 43 | + %op = select i1 %cond, <4 x float> %lhsv, <4 x float> %rhsv |
| 44 | + store <4 x float> %op, ptr %out |
| 45 | + ret void |
| 46 | +} |
| 47 | + |
| 48 | +define void @select_2x2_rhs(i1 %cond, ptr %lhs, ptr %rhs, ptr %out) { |
| 49 | +; CHECK-LABEL: @select_2x2_rhs( |
| 50 | +; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x float>, ptr [[RHS:%.*]], align 16 |
| 51 | +; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[RHS]], i64 2 |
| 52 | +; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <2 x float>, ptr [[VEC_GEP]], align 8 |
| 53 | +; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <2 x float>, ptr [[RHS1:%.*]], align 4 |
| 54 | +; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr float, ptr [[RHS1]], i64 2 |
| 55 | +; CHECK-NEXT: [[COL_LOAD4:%.*]] = load <2 x float>, ptr [[VEC_GEP3]], align 4 |
| 56 | +; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[COND:%.*]], <2 x float> [[COL_LOAD]], <2 x float> [[COL_LOAD2]] |
| 57 | +; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[COND]], <2 x float> [[COL_LOAD1]], <2 x float> [[COL_LOAD4]] |
| 58 | +; CHECK-NEXT: store <2 x float> [[TMP1]], ptr [[OUT:%.*]], align 16 |
| 59 | +; CHECK-NEXT: [[VEC_GEP2:%.*]] = getelementptr float, ptr [[OUT]], i64 2 |
| 60 | +; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[VEC_GEP2]], align 8 |
| 61 | +; CHECK-NEXT: ret void |
| 62 | +; |
| 63 | + %lhsv = load <4 x float>, ptr %lhs |
| 64 | + %rhsv = call <4 x float> @llvm.matrix.column.major.load(ptr %rhs, i64 2, i1 false, i32 2, i32 2) |
| 65 | + %op = select i1 %cond, <4 x float> %lhsv, <4 x float> %rhsv |
| 66 | + store <4 x float> %op, ptr %out |
| 67 | + ret void |
| 68 | +} |
0 commit comments