llvm/llvm/test/Transforms/CodeGenPrepare/X86/masked-gather-struct-gep.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
; REQUIRES: x86-registered-target
target triple = "x86_64-pc-linux"

%s = type <{ float, i32, i8, [3 x i8] }>

declare <4 x float> @llvm.masked.gather.v4f32.v4p0(<4 x ptr>, i32 immarg, <4 x i1>, <4 x float>)

define <4 x float> @foo(ptr %p) {
; CHECK-LABEL: define <4 x float> @foo
; CHECK-SAME: (ptr [[P:%.*]]) {
; CHECK-NEXT:    [[TMP1:%.*]] = bitcast ptr [[P]] to ptr
; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr float, ptr [[TMP1]], <4 x i32> zeroinitializer
; CHECK-NEXT:    [[GATHER:%.*]] = call <4 x float> @llvm.masked.gather.v4f32.v4p0(<4 x ptr> [[TMP2]], i32 0, <4 x i1> zeroinitializer, <4 x float> zeroinitializer)
; CHECK-NEXT:    ret <4 x float> [[GATHER]]
;
  %base.splatinsert = insertelement <4 x ptr> poison, ptr %p, i32 0
  %base = shufflevector <4 x ptr> %base.splatinsert, <4 x ptr> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
  %gep = getelementptr %s, <4 x ptr> %base, <4 x i64> zeroinitializer, <4 x i32> zeroinitializer
  %gather = call <4 x float> @llvm.masked.gather.v4f32.v4p0(<4 x ptr> %gep, i32 0, <4 x i1> zeroinitializer, <4 x float> zeroinitializer)
  ret <4 x float> %gather
}