1*9880d681SAndroid Build Coastguard Worker; Verify that we can create unaligned loads and stores from VSX intrinsics. 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64-unknown-linux-gnu" 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker@vf = common global <4 x float> zeroinitializer, align 1 8*9880d681SAndroid Build Coastguard Worker@res_vf = common global <4 x float> zeroinitializer, align 1 9*9880d681SAndroid Build Coastguard Worker@vd = common global <2 x double> zeroinitializer, align 1 10*9880d681SAndroid Build Coastguard Worker@res_vd = common global <2 x double> zeroinitializer, align 1 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Workerdefine void @test1() { 13*9880d681SAndroid Build Coastguard Workerentry: 14*9880d681SAndroid Build Coastguard Worker %t1 = alloca <4 x float>*, align 8 15*9880d681SAndroid Build Coastguard Worker %t2 = alloca <2 x double>*, align 8 16*9880d681SAndroid Build Coastguard Worker store <4 x float>* @vf, <4 x float>** %t1, align 8 17*9880d681SAndroid Build Coastguard Worker %0 = load <4 x float>*, <4 x float>** %t1, align 8 18*9880d681SAndroid Build Coastguard Worker %1 = bitcast <4 x float>* %0 to i8* 19*9880d681SAndroid Build Coastguard Worker %2 = call <4 x i32> @llvm.ppc.vsx.lxvw4x(i8* %1) 20*9880d681SAndroid Build Coastguard Worker store <4 x float>* @res_vf, <4 x float>** %t1, align 8 21*9880d681SAndroid Build Coastguard Worker %3 = load <4 x float>*, <4 x float>** %t1, align 8 22*9880d681SAndroid Build Coastguard Worker %4 = bitcast <4 x float>* %3 to i8* 23*9880d681SAndroid Build Coastguard Worker call void @llvm.ppc.vsx.stxvw4x(<4 x i32> %2, i8* %4) 24*9880d681SAndroid Build Coastguard Worker store <2 x double>* @vd, <2 x double>** %t2, align 8 25*9880d681SAndroid Build Coastguard Worker %5 = load <2 x double>*, <2 x double>** %t2, align 8 26*9880d681SAndroid Build Coastguard Worker %6 = bitcast <2 x double>* %5 to i8* 27*9880d681SAndroid Build Coastguard Worker %7 = call <2 x double> @llvm.ppc.vsx.lxvd2x(i8* %6) 28*9880d681SAndroid Build Coastguard Worker store <2 x double>* @res_vd, <2 x double>** %t2, align 8 29*9880d681SAndroid Build Coastguard Worker %8 = load <2 x double>*, <2 x double>** %t2, align 8 30*9880d681SAndroid Build Coastguard Worker %9 = bitcast <2 x double>* %8 to i8* 31*9880d681SAndroid Build Coastguard Worker call void @llvm.ppc.vsx.stxvd2x(<2 x double> %7, i8* %9) 32*9880d681SAndroid Build Coastguard Worker ret void 33*9880d681SAndroid Build Coastguard Worker} 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test1 36*9880d681SAndroid Build Coastguard Worker; CHECK: %0 = load <4 x i32>, <4 x i32>* bitcast (<4 x float>* @vf to <4 x i32>*), align 1 37*9880d681SAndroid Build Coastguard Worker; CHECK: store <4 x i32> %0, <4 x i32>* bitcast (<4 x float>* @res_vf to <4 x i32>*), align 1 38*9880d681SAndroid Build Coastguard Worker; CHECK: %1 = load <2 x double>, <2 x double>* @vd, align 1 39*9880d681SAndroid Build Coastguard Worker; CHECK: store <2 x double> %1, <2 x double>* @res_vd, align 1 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Workerdeclare <4 x i32> @llvm.ppc.vsx.lxvw4x(i8*) 42*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.ppc.vsx.stxvw4x(<4 x i32>, i8*) 43*9880d681SAndroid Build Coastguard Workerdeclare <2 x double> @llvm.ppc.vsx.lxvd2x(i8*) 44*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.ppc.vsx.stxvd2x(<2 x double>, i8*) 45