| 1 |
;=========================== begin_copyright_notice ============================ |
| 2 |
; |
| 3 |
; Copyright (C) 2024 Intel Corporation |
| 4 |
; |
| 5 |
; SPDX-License-Identifier: MIT |
| 6 |
; |
| 7 |
;============================ end_copyright_notice ============================= |
| 8 |
|
| 9 |
; REQUIRES: opaque-pointers |
| 10 |
; RUN: opt -passes=cmsimdcflowering -S < %s | FileCheck %s |
| 11 |
|
| 12 |
@g1 = internal global <64 x i32> undef |
| 13 |
|
| 14 |
; CHECK: @EM = internal global <32 x i1> |
| 15 |
|
| 16 |
define dso_local dllexport void @test(<32 x i16> %cond1, <32 x i16> %cond2, <32 x i32> %addrs, <32 x i1> %pred) { |
| 17 |
%g = alloca <64 x i32>, align 512 |
| 18 |
%cmp1 = icmp ne <32 x i16> %cond1, zeroinitializer |
| 19 |
%call = call i1 @llvm.genx.simdcf.any.v32i1(<32 x i1> %cmp1) |
| 20 |
br i1 %call, label %if.then, label %if.end |
| 21 |
|
| 22 |
; CHECK-LABEL: if.then: |
| 23 |
if.then: |
| 24 |
; CHECK: [[EM_LOAD1:%.*]] = load <32 x i1>, ptr @EM |
| 25 |
; CHECK-NEXT: [[EM_UPDATE1:%.*]] = and <32 x i1> %pred, [[EM_LOAD1]] |
| 26 |
; 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_UPDATE1]]) |
| 27 |
%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> %pred) |
| 28 |
; CHECK: [[EM_LOAD2:%.*]] = load <32 x i1>, ptr @EM |
| 29 |
; CHECK-NEXT: [[EM_UPDATE2:%.*]] = and <32 x i1> %pred, [[EM_LOAD2]] |
| 30 |
; CHECK-NEXT: [[CHENNELEM:%.*]] = shufflevector <32 x i1> [[EM_UPDATE2]], <32 x i1> undef, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31> |
| 31 |
; CHECK-NEXT: [[CALL1_SIMDCFPRED1:%.*]] = select <64 x i1> [[CHENNELEM]], <64 x i32> [[CALL1]] |
| 32 |
store <64 x i32> %call1, ptr %g |
| 33 |
%cmp2 = icmp ne <32 x i16> %cond2, zeroinitializer |
| 34 |
%nest = call i1 @llvm.genx.simdcf.any.v32i1(<32 x i1> %cmp2) |
| 35 |
br i1 %nest, label %if.then2, label %if.end2 |
| 36 |
|
| 37 |
; CHECK-LABEL: if.then2: |
| 38 |
if.then2: |
| 39 |
; CHECK: [[EM_LOAD3:%.*]] = load <32 x i1>, ptr @EM |
| 40 |
; CHECK-NEXT: [[EM_UPDATE2:%.*]] = and <32 x i1> %pred, [[EM_LOAD3]] |
| 41 |
; CHECK-NEXT: [[CHENNELEM2:%.*]] = shufflevector <32 x i1> [[EM_UPDATE2]], <32 x i1> undef, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31> |
| 42 |
; CHECK-NEXT: %call1.simdcfpred7 = select <64 x i1> [[CHENNELEM2]], <64 x i32> [[CALL1]] |
| 43 |
store <64 x i32> %call1, ptr %g |
| 44 |
br label %if.end2 |
| 45 |
|
| 46 |
if.end2: |
| 47 |
br label %if.end |
| 48 |
|
| 49 |
if.end: |
| 50 |
%ld = load <64 x i32>, ptr %g |
| 51 |
store <64 x i32> %ld, ptr @g1 |
| 52 |
ret void |
| 53 |
} |
| 54 |
|
| 55 |
declare <64 x i32> @llvm.genx.gather4.masked.scaled2.v64i32.v32i32.v32i1(i32, i16, i32, i32, <32 x i32>, <32 x i1>) |
| 56 |
declare <64 x i32> @llvm.genx.wrregioni.v64i32.v16i32.i16.i1(<64 x i32> %load, <64 x i32> %call, i32, i32, i32, i16, i32, i1) |
| 57 |
declare i1 @llvm.genx.simdcf.any.v32i1(<32 x i1>) |