vsx-unaligned.ll 1.8 KB

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