| 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 |
; CHECK: @EM = internal global <32 x i1> |
| 13 |
|
| 14 |
@g2 = internal global <32 x i32> undef |
| 15 |
|
| 16 |
define dso_local dllexport void @test_gather(<32 x i16> %mask, <32 x i32> %addrs) { |
| 17 |
%g = alloca <32 x i32>, align 512 |
| 18 |
%cmp = icmp ne <32 x i16> %mask, zeroinitializer |
| 19 |
%call = call i1 @llvm.genx.simdcf.any.v32i1(<32 x i1> %cmp) |
| 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: [[CALL1:%.*]] = call <32 x i32> @llvm.genx.gather.masked.scaled2.v32i32.v32i32.v32i1(i32 2, i16 0, i32 254, i32 0, <32 x i32> %addrs, <32 x i1> [[EM_LOAD1]]) |
| 26 |
%call1 = call <32 x i32> @llvm.genx.gather.masked.scaled2.v32i32.v32i32.v32i1(i32 2, i16 0, i32 254, i32 0, <32 x i32> %addrs, <32 x i1> <i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1>) |
| 27 |
; CHECK: [[EM_LOAD2:%.*]] = load <32 x i1>, ptr @EM |
| 28 |
; CHECK-NEXT: [[CALL1_SIMDCFPREDL:%.*]] = select <32 x i1> [[EM_LOAD2:%.*]], <32 x i32> [[CALL1:%.*]] |
| 29 |
store <32 x i32> %call1, ptr %g |
| 30 |
br label %if.end |
| 31 |
|
| 32 |
if.end: |
| 33 |
%ld = load <32 x i32>, ptr %g |
| 34 |
store <32 x i32> %ld, ptr @g2 |
| 35 |
ret void |
| 36 |
} |
| 37 |
|
| 38 |
declare <32 x i32> @llvm.genx.gather.masked.scaled2.v32i32.v32i32.v32i1(i32, i16, i32, i32, <32 x i32>, <32 x i1>) |
| 39 |
declare i1 @llvm.genx.simdcf.any.v32i1(<32 x i1>) |