;=========================== begin_copyright_notice ============================ ; ; Copyright (C) 2024 Intel Corporation ; ; SPDX-License-Identifier: MIT ; ;============================ end_copyright_notice ============================= ; REQUIRES: opaque-pointers ; RUN: opt -passes=cmsimdcflowering -S < %s | FileCheck %s @g1 = internal global <64 x i32> undef ; CHECK: @EM = internal global <32 x i1> ; CHECK-LABEL: @test define dso_local dllexport void @test(<32 x i16> %mask) { %g = alloca <64 x i32>, align 512 %cmp = icmp ne <32 x i16> %mask, zeroinitializer %call = call i1 @llvm.genx.simdcf.any.v32i1(<32 x i1> %cmp) br i1 %call, label %if.then, label %if.end ; CHECK-LABEL: if.then: if.then: ; CHECK: [[CALL1:%.*]] = call <64 x i32> @_Z24func_replicate_mask_attrv() %call1 = call <64 x i32> @_Z24func_replicate_mask_attrv() ; CHECK: [[EM_LOAD:%.*]] = load <32 x i1>, ptr @EM ; CHECK-NEXT: [[CHENNELEM:%.*]] = shufflevector <32 x i1> [[EM_LOAD]], <32 x i1> undef, <64 x i32> ; CHECK-NEXT: [[CALL1_SIMDCFPREDL:%.*]] = select <64 x i1> [[CHENNELEM]], <64 x i32> [[CALL1]] store <64 x i32> %call1, ptr %g br label %if.end if.end: %ld = load <64 x i32>, ptr %g store <64 x i32> %ld, ptr @g1 ret void } ; CHECK-LABEL: @test_gather4 define dso_local dllexport void @test_gather4(<32 x i16> %mask, <32 x i32> %addrs) { %g = alloca <64 x i32>, align 512 %cmp = icmp ne <32 x i16> %mask, zeroinitializer %call = call i1 @llvm.genx.simdcf.any.v32i1(<32 x i1> %cmp) br i1 %call, label %if.then, label %if.end ; CHECK-LABEL: if.then: if.then: ; CHECK: [[EM_LOAD1:%.*]] = load <32 x i1>, ptr @EM ; CHECK-NEXT: [[CALL1:%.*]] = call <64 x i32> @llvm.genx.gather4.masked.scaled2.v64i32.v32i32.v32i1(i32 12, i16 0, i32 254, i32 0, <32 x i32> %addrs, <32 x i1> [[EM_LOAD1]]) %call1 = call <64 x i32> @llvm.genx.gather4.masked.scaled2.v64i32.v32i32.v32i1(i32 12, i16 0, i32 254, i32 0, <32 x i32> %addrs, <32 x i1> ) ; CHECK: [[EM_LOAD2:%.*]] = load <32 x i1>, ptr @EM ; CHECK-NEXT: [[CHENNELEM:%.*]] = shufflevector <32 x i1> [[EM_LOAD2]], <32 x i1> undef, <64 x i32> ; CHECK-NEXT: [[CALL1_SIMDCFPREDL:%.*]] = select <64 x i1> [[CHENNELEM]], <64 x i32> [[CALL1]] store <64 x i32> %call1, ptr %g br label %if.end if.end: %ld = load <64 x i32>, ptr %g store <64 x i32> %ld, ptr @g1 ret void } define internal <64 x i32> @_Z24func_replicate_mask_attrv() #0 { ret <64 x i32> zeroinitializer } declare <64 x i32> @llvm.genx.gather4.masked.scaled2.v64i32.v32i32.v32i1(i32, i16, i32, i32, <32 x i32>, <32 x i1>) declare i1 @llvm.genx.simdcf.any.v32i1(<32 x i1>) attributes #0 = { noinline nounwind "CMGenxReplicateMask"="2"}