File: vsx-unaligned.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (44 lines) | stat: -rw-r--r-- 1,871 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
; Verify that we can create unaligned loads and stores from VSX intrinsics.

; RUN: opt < %s -instcombine -S | FileCheck %s

target triple = "powerpc64-unknown-linux-gnu"

@vf = common global <4 x float> zeroinitializer, align 1
@res_vf = common global <4 x float> zeroinitializer, align 1
@vd = common global <2 x double> zeroinitializer, align 1
@res_vd = common global <2 x double> zeroinitializer, align 1

define void @test1() {
entry:
  %t1 = alloca <4 x float>*, align 8
  %t2 = alloca <2 x double>*, align 8
  store <4 x float>* @vf, <4 x float>** %t1, align 8
  %0 = load <4 x float>*, <4 x float>** %t1, align 8
  %1 = bitcast <4 x float>* %0 to i8*
  %2 = call <4 x i32> @llvm.ppc.vsx.lxvw4x(i8* %1)
  store <4 x float>* @res_vf, <4 x float>** %t1, align 8
  %3 = load <4 x float>*, <4 x float>** %t1, align 8
  %4 = bitcast <4 x float>* %3 to i8*
  call void @llvm.ppc.vsx.stxvw4x(<4 x i32> %2, i8* %4)
  store <2 x double>* @vd, <2 x double>** %t2, align 8
  %5 = load <2 x double>*, <2 x double>** %t2, align 8
  %6 = bitcast <2 x double>* %5 to i8*
  %7 = call <2 x double> @llvm.ppc.vsx.lxvd2x(i8* %6)
  store <2 x double>* @res_vd, <2 x double>** %t2, align 8
  %8 = load <2 x double>*, <2 x double>** %t2, align 8
  %9 = bitcast <2 x double>* %8 to i8*
  call void @llvm.ppc.vsx.stxvd2x(<2 x double> %7, i8* %9)
  ret void
}

; CHECK-LABEL: @test1
; CHECK: %0 = load <4 x i32>, <4 x i32>* bitcast (<4 x float>* @vf to <4 x i32>*), align 1
; CHECK: store <4 x i32> %0, <4 x i32>* bitcast (<4 x float>* @res_vf to <4 x i32>*), align 1
; CHECK: %1 = load <2 x double>, <2 x double>* @vd, align 1
; CHECK: store <2 x double> %1, <2 x double>* @res_vd, align 1

declare <4 x i32> @llvm.ppc.vsx.lxvw4x(i8*)
declare void @llvm.ppc.vsx.stxvw4x(<4 x i32>, i8*)
declare <2 x double> @llvm.ppc.vsx.lxvd2x(i8*)
declare void @llvm.ppc.vsx.stxvd2x(<2 x double>, i8*)