1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S %s -scalarize-masked-mem-intrin -mtriple=x86_64-linux-gnu | FileCheck %s
4 define void @scalarize_v2i64(<2 x i64>* %p, <2 x i1> %mask, <2 x i64> %data) {
5 ; CHECK-LABEL: @scalarize_v2i64(
6 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64>* [[P:%.*]] to i64*
7 ; CHECK-NEXT: [[SCALAR_MASK:%.*]] = bitcast <2 x i1> [[MASK:%.*]] to i2
8 ; CHECK-NEXT: [[TMP2:%.*]] = and i2 [[SCALAR_MASK]], 1
9 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i2 [[TMP2]], 0
10 ; CHECK-NEXT: br i1 [[TMP3]], label [[COND_STORE:%.*]], label [[ELSE:%.*]]
12 ; CHECK-NEXT: [[TMP4:%.*]] = extractelement <2 x i64> [[DATA:%.*]], i64 0
13 ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i64, i64* [[TMP1]], i32 0
14 ; CHECK-NEXT: store i64 [[TMP4]], i64* [[TMP5]], align 8
15 ; CHECK-NEXT: br label [[ELSE]]
17 ; CHECK-NEXT: [[TMP6:%.*]] = and i2 [[SCALAR_MASK]], -2
18 ; CHECK-NEXT: [[TMP7:%.*]] = icmp ne i2 [[TMP6]], 0
19 ; CHECK-NEXT: br i1 [[TMP7]], label [[COND_STORE1:%.*]], label [[ELSE2:%.*]]
21 ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i64> [[DATA]], i64 1
22 ; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i64, i64* [[TMP1]], i32 1
23 ; CHECK-NEXT: store i64 [[TMP8]], i64* [[TMP9]], align 8
24 ; CHECK-NEXT: br label [[ELSE2]]
26 ; CHECK-NEXT: ret void
28 call void @llvm.masked.store.v2i64.p0v2i64(<2 x i64> %data, <2 x i64>* %p, i32 128, <2 x i1> %mask)
32 define void @scalarize_v2i64_ones_mask(<2 x i64>* %p, <2 x i64> %data) {
33 ; CHECK-LABEL: @scalarize_v2i64_ones_mask(
34 ; CHECK-NEXT: store <2 x i64> [[DATA:%.*]], <2 x i64>* [[P:%.*]], align 8
35 ; CHECK-NEXT: ret void
37 call void @llvm.masked.store.v2i64.p0v2i64(<2 x i64> %data, <2 x i64>* %p, i32 8, <2 x i1> <i1 true, i1 true>)
41 define void @scalarize_v2i64_zero_mask(<2 x i64>* %p, <2 x i64> %data) {
42 ; CHECK-LABEL: @scalarize_v2i64_zero_mask(
43 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64>* [[P:%.*]] to i64*
44 ; CHECK-NEXT: ret void
46 call void @llvm.masked.store.v2i64.p0v2i64(<2 x i64> %data, <2 x i64>* %p, i32 8, <2 x i1> <i1 false, i1 false>)
50 define void @scalarize_v2i64_const_mask(<2 x i64>* %p, <2 x i64> %data) {
51 ; CHECK-LABEL: @scalarize_v2i64_const_mask(
52 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64>* [[P:%.*]] to i64*
53 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <2 x i64> [[DATA:%.*]], i64 1
54 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i64, i64* [[TMP1]], i32 1
55 ; CHECK-NEXT: store i64 [[TMP2]], i64* [[TMP3]], align 8
56 ; CHECK-NEXT: ret void
58 call void @llvm.masked.store.v2i64.p0v2i64(<2 x i64> %data, <2 x i64>* %p, i32 8, <2 x i1> <i1 false, i1 true>)
62 declare void @llvm.masked.store.v2i64.p0v2i64(<2 x i64>, <2 x i64>*, i32, <2 x i1>)