• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Show that we know how to translate vector urem, srem and frem.
2
3; NOTE: We use -O2 to get rid of memory stores.
4
5; REQUIRES: allow_dump
6
7; Compile using standalone assembler.
8; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 -mattr=hwdiv-arm \
9; RUN:   | FileCheck %s --check-prefix=ASM
10
11define internal <4 x i32> @Urem4i32(<4 x i32> %a, <4 x i32> %b) {
12; ASM-LABEL:Urem4i32:
13
14entry:
15; ASM-NEXT:.LUrem4i32$entry:
16
17  %v = urem <4 x i32> %a, %b
18
19; ASM-LABEL:.LUrem4i32$local$__0:
20; ASM-NEXT: udiv r2, r0, r1
21; ASM-NEXT: mls r2, r2, r1, r0
22; ASM-NEXT: vmov.32 d4[0], r2
23
24; ASM-LABEL:.LUrem4i32$local$__1:
25; ASM-NEXT: udiv r2, r0, r1
26; ASM-NEXT: mls r2, r2, r1, r0
27; ASM-NEXT: vmov.32 d4[1], r2
28
29; ASM-LABEL:.LUrem4i32$local$__2:
30; ASM-NEXT: udiv r2, r0, r1
31; ASM-NEXT: mls r2, r2, r1, r0
32; ASM-NEXT: vmov.32 d5[0], r2
33
34; ASM-LABEL:.LUrem4i32$local$__3:
35; ASM-NEXT: udiv r2, r0, r1
36; ASM-NEXT: mls r2, r2, r1, r0
37; ASM-NEXT: vmov.32 d5[1], r2
38
39  ret <4 x i32> %v
40}
41
42define internal <4 x i32> @Srem4i32(<4 x i32> %a, <4 x i32> %b) {
43; ASM-LABEL:Srem4i32:
44
45entry:
46; ASM-NEXT:.LSrem4i32$entry:
47
48  %v = srem <4 x i32> %a, %b
49
50; ASM-LABEL:.LSrem4i32$local$__0:
51; ASM-NEXT: sdiv r2, r0, r1
52; ASM-NEXT: mls r2, r2, r1, r0
53; ASM-NEXT: vmov.32 d4[0], r2
54
55; ASM-LABEL:.LSrem4i32$local$__1:
56; ASM-NEXT: sdiv r2, r0, r1
57; ASM-NEXT: mls r2, r2, r1, r0
58; ASM-NEXT: vmov.32 d4[1], r2
59
60; ASM-LABEL:.LSrem4i32$local$__2:
61; ASM-NEXT: sdiv r2, r0, r1
62; ASM-NEXT: mls r2, r2, r1, r0
63; ASM-NEXT: vmov.32 d5[0], r2
64
65; ASM-LABEL:.LSrem4i32$local$__3:
66; ASM-NEXT: sdiv r2, r0, r1
67; ASM-NEXT: mls r2, r2, r1, r0
68; ASM-NEXT: vmov.32 d5[1], r2
69
70  ret <4 x i32> %v
71}
72
73define internal <4 x float> @Frem4float(<4 x float> %a, <4 x float> %b) {
74; ASM-LABEL:Frem4float:
75
76entry:
77; ASM-NEXT:.LFrem4float$entry:
78
79  %v = frem <4 x float> %a, %b
80
81; ASM:         vmov.f32 s0, s16
82; ASM-NEXT: vmov.f32 s1, s20
83; ASM-NEXT: bl fmodf
84
85; ASM:  vmov.f32 s0, s17
86; ASM-NEXT: vmov.f32 s1, s21
87; ASM-NEXT: bl fmodf
88
89; ASM:  vmov.f32 s0, s18
90; ASM-NEXT: vmov.f32 s1, s22
91; ASM-NEXT: bl fmodf
92
93; ASM:  vmov.f32 s16, s19
94; ASM-NEXT: vmov.f32 s20, s23
95; ASM: bl fmodf
96
97  ret <4 x float> %v
98}
99