1; RUN: opt -instcombine -S < %s | FileCheck %s 2 3declare <2 x double> @llvm.masked.load.v2f64.p0v2f64(<2 x double>* %ptrs, i32, <2 x i1> %mask, <2 x double> %src0) 4declare void @llvm.masked.store.v2f64.p0v2f64(<2 x double> %val, <2 x double>* %ptrs, i32, <2 x i1> %mask) 5declare <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptrs, i32, <2 x i1> %mask, <2 x double> %passthru) 6declare void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptrs, i32, <2 x i1> %mask) 7 8define <2 x double> @load_zeromask(<2 x double>* %ptr, <2 x double> %passthru) { 9 %res = call <2 x double> @llvm.masked.load.v2f64.p0v2f64(<2 x double>* %ptr, i32 1, <2 x i1> zeroinitializer, <2 x double> %passthru) 10 ret <2 x double> %res 11 12; CHECK-LABEL: @load_zeromask( 13; CHECK-NEXT: ret <2 x double> %passthru 14} 15 16define <2 x double> @load_onemask(<2 x double>* %ptr, <2 x double> %passthru) { 17 %res = call <2 x double> @llvm.masked.load.v2f64.p0v2f64(<2 x double>* %ptr, i32 2, <2 x i1> <i1 1, i1 1>, <2 x double> %passthru) 18 ret <2 x double> %res 19 20; CHECK-LABEL: @load_onemask( 21; CHECK-NEXT: %unmaskedload = load <2 x double>, <2 x double>* %ptr, align 2 22; CHECK-NEXT: ret <2 x double> %unmaskedload 23} 24 25define <2 x double> @load_undefmask(<2 x double>* %ptr, <2 x double> %passthru) { 26 %res = call <2 x double> @llvm.masked.load.v2f64.p0v2f64(<2 x double>* %ptr, i32 2, <2 x i1> <i1 1, i1 undef>, <2 x double> %passthru) 27 ret <2 x double> %res 28 29; CHECK-LABEL: @load_undefmask( 30; CHECK-NEXT: %unmaskedload = load <2 x double>, <2 x double>* %ptr, align 2 31; CHECK-NEXT: ret <2 x double> %unmaskedload 32} 33 34define void @store_zeromask(<2 x double>* %ptr, <2 x double> %val) { 35 call void @llvm.masked.store.v2f64.p0v2f64(<2 x double> %val, <2 x double>* %ptr, i32 3, <2 x i1> zeroinitializer) 36 ret void 37 38; CHECK-LABEL: @store_zeromask( 39; CHECK-NEXT: ret void 40} 41 42define void @store_onemask(<2 x double>* %ptr, <2 x double> %val) { 43 call void @llvm.masked.store.v2f64.p0v2f64(<2 x double> %val, <2 x double>* %ptr, i32 4, <2 x i1> <i1 1, i1 1>) 44 ret void 45 46; CHECK-LABEL: @store_onemask( 47; CHECK-NEXT: store <2 x double> %val, <2 x double>* %ptr, align 4 48; CHECK-NEXT: ret void 49} 50 51define <2 x double> @gather_zeromask(<2 x double*> %ptrs, <2 x double> %passthru) { 52 %res = call <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptrs, i32 5, <2 x i1> zeroinitializer, <2 x double> %passthru) 53 ret <2 x double> %res 54 55; CHECK-LABEL: @gather_zeromask( 56; CHECK-NEXT: ret <2 x double> %passthru 57} 58 59define void @scatter_zeromask(<2 x double*> %ptrs, <2 x double> %val) { 60 call void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptrs, i32 6, <2 x i1> zeroinitializer) 61 ret void 62 63; CHECK-LABEL: @scatter_zeromask( 64; CHECK-NEXT: ret void 65} 66 67