1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s --check-prefixes=ALL,VSX
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -mattr=-vsx < %s | FileCheck %s --check-prefixes=ALL,NOVSX
5 ; Check VMX 64-bit integer operations
7 define <2 x i64> @test_add(<2 x i64> %x, <2 x i64> %y) nounwind {
10 ; ALL-NEXT: vaddudm 2, 2, 3
12 %result = add <2 x i64> %x, %y
16 define <2 x i64> @increment_by_one(<2 x i64> %x) nounwind {
17 ; VSX-LABEL: increment_by_one:
19 ; VSX-NEXT: addis 3, 2, .LCPI1_0@toc@ha
20 ; VSX-NEXT: addi 3, 3, .LCPI1_0@toc@l
21 ; VSX-NEXT: lxvd2x 35, 0, 3
22 ; VSX-NEXT: vaddudm 2, 2, 3
25 ; NOVSX-LABEL: increment_by_one:
27 ; NOVSX-NEXT: addis 3, 2, .LCPI1_0@toc@ha
28 ; NOVSX-NEXT: addi 3, 3, .LCPI1_0@toc@l
29 ; NOVSX-NEXT: lvx 3, 0, 3
30 ; NOVSX-NEXT: vaddudm 2, 2, 3
32 %result = add <2 x i64> %x, <i64 1, i64 1>
36 define <2 x i64> @increment_by_val(<2 x i64> %x, i64 %val) nounwind {
37 ; VSX-LABEL: increment_by_val:
39 ; VSX-NEXT: mtvsrd 0, 5
40 ; VSX-NEXT: xxspltd 35, 0, 0
41 ; VSX-NEXT: vaddudm 2, 2, 3
44 ; NOVSX-LABEL: increment_by_val:
46 ; NOVSX-NEXT: addi 3, 1, -16
47 ; NOVSX-NEXT: std 5, -8(1)
48 ; NOVSX-NEXT: std 5, -16(1)
49 ; NOVSX-NEXT: lvx 3, 0, 3
50 ; NOVSX-NEXT: vaddudm 2, 2, 3
52 %tmpvec = insertelement <2 x i64> <i64 0, i64 0>, i64 %val, i32 0
53 %tmpvec2 = insertelement <2 x i64> %tmpvec, i64 %val, i32 1
54 %result = add <2 x i64> %x, %tmpvec2
56 ; FIXME: This is currently generating the following instruction sequence
64 ; This will almost certainly cause a load-hit-store hazard.
65 ; Since val is a value parameter, it should not need to be
66 ; saved onto the stack at all (unless we're using this to set
67 ; up the vector register). Instead, it would be better to splat
68 ; the value into a vector register.
71 define <2 x i64> @test_sub(<2 x i64> %x, <2 x i64> %y) nounwind {
72 ; ALL-LABEL: test_sub:
74 ; ALL-NEXT: vsubudm 2, 2, 3
76 %result = sub <2 x i64> %x, %y
80 define <2 x i64> @decrement_by_one(<2 x i64> %x) nounwind {
81 ; VSX-LABEL: decrement_by_one:
83 ; VSX-NEXT: vspltisb 3, -1
84 ; VSX-NEXT: vsubudm 2, 2, 3
87 ; NOVSX-LABEL: decrement_by_one:
89 ; NOVSX-NEXT: addis 3, 2, .LCPI4_0@toc@ha
90 ; NOVSX-NEXT: addi 3, 3, .LCPI4_0@toc@l
91 ; NOVSX-NEXT: lvx 3, 0, 3
92 ; NOVSX-NEXT: vsubudm 2, 2, 3
94 %result = sub <2 x i64> %x, <i64 -1, i64 -1>
98 define <2 x i64> @decrement_by_val(<2 x i64> %x, i64 %val) nounwind {
99 ; VSX-LABEL: decrement_by_val:
101 ; VSX-NEXT: mtvsrd 0, 5
102 ; VSX-NEXT: xxspltd 35, 0, 0
103 ; VSX-NEXT: vsubudm 2, 2, 3
106 ; NOVSX-LABEL: decrement_by_val:
108 ; NOVSX-NEXT: addi 3, 1, -16
109 ; NOVSX-NEXT: std 5, -8(1)
110 ; NOVSX-NEXT: std 5, -16(1)
111 ; NOVSX-NEXT: lvx 3, 0, 3
112 ; NOVSX-NEXT: vsubudm 2, 2, 3
114 %tmpvec = insertelement <2 x i64> <i64 0, i64 0>, i64 %val, i32 0
115 %tmpvec2 = insertelement <2 x i64> %tmpvec, i64 %val, i32 1
116 %result = sub <2 x i64> %x, %tmpvec2
117 ret <2 x i64> %result