1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
6 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
9 ; This test case aims to test the vector modulo instructions on Power10.
10 ; The vector modulo instructions operate on signed and unsigned words
13 ; The vector modulo instructions operate on signed and unsigned words,
14 ; doublewords and 128-bit values.
17 define <1 x i128> @test_vmodsq(<1 x i128> %x, <1 x i128> %y) nounwind readnone {
18 ; CHECK-LABEL: test_vmodsq:
20 ; CHECK-NEXT: vmodsq v2, v2, v3
22 %tmp = srem <1 x i128> %x, %y
26 define <1 x i128> @test_vmoduq(<1 x i128> %x, <1 x i128> %y) nounwind readnone {
27 ; CHECK-LABEL: test_vmoduq:
29 ; CHECK-NEXT: vmoduq v2, v2, v3
31 %tmp = urem <1 x i128> %x, %y
35 define <2 x i64> @test_vmodud(<2 x i64> %a, <2 x i64> %b) {
36 ; CHECK-LABEL: test_vmodud:
37 ; CHECK: # %bb.0: # %entry
38 ; CHECK-NEXT: vmodud v2, v2, v3
41 %rem = urem <2 x i64> %a, %b
45 define <2 x i64> @test_vmodsd(<2 x i64> %a, <2 x i64> %b) {
46 ; CHECK-LABEL: test_vmodsd:
47 ; CHECK: # %bb.0: # %entry
48 ; CHECK-NEXT: vmodsd v2, v2, v3
51 %rem = srem <2 x i64> %a, %b
55 define <4 x i32> @test_vmoduw(<4 x i32> %a, <4 x i32> %b) {
56 ; CHECK-LABEL: test_vmoduw:
57 ; CHECK: # %bb.0: # %entry
58 ; CHECK-NEXT: vmoduw v2, v2, v3
61 %rem = urem <4 x i32> %a, %b
65 define <4 x i32> @test_vmodsw(<4 x i32> %a, <4 x i32> %b) {
66 ; CHECK-LABEL: test_vmodsw:
67 ; CHECK: # %bb.0: # %entry
68 ; CHECK-NEXT: vmodsw v2, v2, v3
71 %rem = srem <4 x i32> %a, %b
75 define <2 x i64> @test_vmodud_with_div(<2 x i64> %a, <2 x i64> %b) {
76 ; CHECK-LABEL: test_vmodud_with_div:
77 ; CHECK: # %bb.0: # %entry
78 ; CHECK-NEXT: vmodud v4, v2, v3
79 ; CHECK-NEXT: vdivud v2, v2, v3
80 ; CHECK-NEXT: vaddudm v2, v4, v2
83 %rem = urem <2 x i64> %a, %b
84 %div = udiv <2 x i64> %a, %b
85 %add = add <2 x i64> %rem, %div
89 define <2 x i64> @test_vmodsd_with_div(<2 x i64> %a, <2 x i64> %b) {
90 ; CHECK-LABEL: test_vmodsd_with_div:
91 ; CHECK: # %bb.0: # %entry
92 ; CHECK-NEXT: vmodsd v4, v2, v3
93 ; CHECK-NEXT: vdivsd v2, v2, v3
94 ; CHECK-NEXT: vaddudm v2, v4, v2
97 %rem = srem <2 x i64> %a, %b
98 %div = sdiv <2 x i64> %a, %b
99 %add = add <2 x i64> %rem, %div
103 define <4 x i32> @test_vmoduw_with_div(<4 x i32> %a, <4 x i32> %b) {
104 ; CHECK-LABEL: test_vmoduw_with_div:
105 ; CHECK: # %bb.0: # %entry
106 ; CHECK-NEXT: vmoduw v4, v2, v3
107 ; CHECK-NEXT: vdivuw v2, v2, v3
108 ; CHECK-NEXT: vadduwm v2, v4, v2
111 %rem = urem <4 x i32> %a, %b
112 %div = udiv <4 x i32> %a, %b
113 %add = add <4 x i32> %rem, %div
117 define <4 x i32> @test_vmodsw_div(<4 x i32> %a, <4 x i32> %b) {
118 ; CHECK-LABEL: test_vmodsw_div:
119 ; CHECK: # %bb.0: # %entry
120 ; CHECK-NEXT: vmodsw v4, v2, v3
121 ; CHECK-NEXT: vdivsw v2, v2, v3
122 ; CHECK-NEXT: vadduwm v2, v4, v2
125 %rem = srem <4 x i32> %a, %b
126 %div = sdiv <4 x i32> %a, %b
127 %add = add <4 x i32> %rem, %div