|
| 1 | +;=========================== begin_copyright_notice ============================ |
| 2 | +; |
| 3 | +; Copyright (C) 2024 Intel Corporation |
| 4 | +; |
| 5 | +; SPDX-License-Identifier: MIT |
| 6 | +; |
| 7 | +;============================ end_copyright_notice ============================= |
| 8 | + |
| 9 | +; RUN: %opt %use_old_pass_manager% -GenXPromotePredicate -march=genx64 -mtriple=spir64-unknown-unknown \ |
| 10 | +; RUN: -mcpu=Gen9 -logical-ops-threshold=2 -S < %s | FileCheck %s |
| 11 | + |
| 12 | +; RUN: %opt %use_old_pass_manager% -GenXPromotePredicate -march=genx64 -mtriple=spir64-unknown-unknown \ |
| 13 | +; RUN: -mcpu=XeHPG -logical-ops-threshold=2 -S < %s | FileCheck %s |
| 14 | + |
| 15 | +; RUN: %opt %use_old_pass_manager% -GenXPromotePredicate -march=genx64 -mtriple=spir64-unknown-unknown \ |
| 16 | +; RUN: -mcpu=XeHPC -logical-ops-threshold=2 -S < %s | FileCheck %s |
| 17 | + |
| 18 | +; CHECK-LABEL: f_f |
| 19 | +; CHECK-DAG: [[LESSEQUAL_A_LOAD_widened:%.*]] = bitcast <8 x i1> %lessequal_a_load_ to i8 |
| 20 | +; CHECK-DAG: [[EQUAL_A_LOAD5_widened:%.*]] = bitcast <8 x i1> %equal_a_load5_ to i8 |
| 21 | +; CHECK-DAG: [[LOGICAL_AND_promoted:%.*]] = and i8 [[LESSEQUAL_A_LOAD_widened]], [[EQUAL_A_LOAD5_widened]] |
| 22 | +; CHECK-DAG: [[LOGICAL_AND:%.*]] = bitcast i8 [[LOGICAL_AND_promoted]] to <8 x i1> |
| 23 | +; CHECK-DAG: call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> [[LOGICAL_AND]]) |
| 24 | +; CHECK-DAG: [[RETURNED_LANES_MEMORY_0_promoted:%.*]] = phi i8 [ [[LOGICAL_AND_promoted]], %safe_if_run_true.safe_if_after_true_crit_edge ], [ 0, %allocas.safe_if_after_true_crit_edge ] |
| 25 | +; CHECK-DAG: [[NEG_RETURNED_LANES_promoted:%.*]] = xor i8 [[RETURNED_LANES_MEMORY_0_promoted]], -1 |
| 26 | +; CHECK-DAG: [[NEG_RETURNED_LANES:%.*]] = bitcast i8 [[NEG_RETURNED_LANES_promoted]] to <8 x i1> |
| 27 | +; CHECK-DAG: call void @llvm.genx.svm.scatter.v8i1.v8i64.v8f32(<8 x i1> [[NEG_RETURNED_LANES]], i32 0, <8 x i64> %new_offsets.i.i34, <8 x float> zeroinitializer) |
| 28 | +; CHECK-DAG: icmp eq i8 [[LOGICAL_AND_promoted]], -1 |
| 29 | + |
| 30 | +declare void @llvm.genx.svm.scatter.v8i1.v8i64.v8f32(<8 x i1>, i32, <8 x i64>, <8 x float>) |
| 31 | +declare <8 x float> @llvm.genx.svm.block.ld.unaligned.v8f32.i64(i64) |
| 32 | +declare void @llvm.genx.svm.block.st.i64.v8f32(i64, <8 x float>) |
| 33 | + |
| 34 | +declare i1 @llvm.vector.reduce.or.v8i1(<8 x i1>) |
| 35 | + |
| 36 | +define dllexport spir_kernel void @f_f(float* nocapture %RET, float* %aFOO, i64 %privBase) { |
| 37 | +allocas: |
| 38 | + %svm_ld_ptrtoint = ptrtoint float* %aFOO to i64 |
| 39 | + %aFOO_load_ptr2int_2void2021_masked_load22 = call <8 x float> @llvm.genx.svm.block.ld.unaligned.v8f32.i64(i64 %svm_ld_ptrtoint) |
| 40 | + %lessequal_a_load_ = fcmp ole <8 x float> %aFOO_load_ptr2int_2void2021_masked_load22, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00> |
| 41 | + %equal_a_load5_ = fcmp oeq <8 x float> %aFOO_load_ptr2int_2void2021_masked_load22, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00> |
| 42 | + %logical_and = and <8 x i1> %lessequal_a_load_, %equal_a_load5_ |
| 43 | + %v.i = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %logical_and) |
| 44 | + %ptr_to_int.i.i31 = ptrtoint float* %RET to i64 |
| 45 | + %base.i.i32 = insertelement <8 x i64> undef, i64 %ptr_to_int.i.i31, i32 0 |
| 46 | + %shuffle.i.i33 = shufflevector <8 x i64> %base.i.i32, <8 x i64> undef, <8 x i32> zeroinitializer |
| 47 | + %new_offsets.i.i34 = add <8 x i64> %shuffle.i.i33, <i64 0, i64 4, i64 8, i64 12, i64 16, i64 20, i64 24, i64 28> |
| 48 | + br i1 %v.i, label %safe_if_run_true, label %allocas.safe_if_after_true_crit_edge |
| 49 | + |
| 50 | +allocas.safe_if_after_true_crit_edge: |
| 51 | + br label %safe_if_after_true |
| 52 | + |
| 53 | +safe_if_after_true: |
| 54 | + %returned_lanes_memory.0 = phi <8 x i1> [ %logical_and, %safe_if_run_true.safe_if_after_true_crit_edge ], [ zeroinitializer, %allocas.safe_if_after_true_crit_edge ] |
| 55 | + %"~returned_lanes" = xor <8 x i1> %returned_lanes_memory.0, <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true> |
| 56 | + call void @llvm.genx.svm.scatter.v8i1.v8i64.v8f32(<8 x i1> %"~returned_lanes", i32 0, <8 x i64> %new_offsets.i.i34, <8 x float> zeroinitializer) |
| 57 | + ret void |
| 58 | + |
| 59 | +safe_if_run_true: |
| 60 | + call void @llvm.genx.svm.scatter.v8i1.v8i64.v8f32(<8 x i1> %logical_and, i32 0, <8 x i64> %new_offsets.i.i34, <8 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>) |
| 61 | + %v.i30 = bitcast <8 x i1> %logical_and to i8 |
| 62 | + %"equal__old_mask|returned_lanes" = icmp eq i8 %v.i30, -1 |
| 63 | + br i1 %"equal__old_mask|returned_lanes", label %do_return, label %safe_if_run_true.safe_if_after_true_crit_edge |
| 64 | + |
| 65 | +safe_if_run_true.safe_if_after_true_crit_edge: |
| 66 | + br label %safe_if_after_true |
| 67 | + |
| 68 | +do_return: |
| 69 | + ret void |
| 70 | +} |
0 commit comments