source: trunk/lib_ir/p2s.ll @ 4050

Last change on this file since 4050 was 4050, checked in by linmengl, 5 years ago

add p2s.ll file, p2s_step works now

File size: 1.7 KB
Line 
1declare <4 x i32> @ifh_1(<4 x i32> %cond, <4 x i32> %b, <4 x i32> %c)
2declare <4 x i32> @srli_16(<4 x i32> %a, <8 x i16> %shift_mask)
3declare <4 x i32> @slli_16(<4 x i32> %a, <8 x i16> %shift_mask)
4
5define <4 x i32> @mergeh_8(<4 x i32> %a, <4 x i32> %b) alwaysinline {
6entry:
7  %aa = bitcast <4 x i32> %a to <16 x i8>
8  %bb = bitcast <4 x i32> %b to <16 x i8>
9  %rr = shufflevector <16 x i8> %bb, <16 x i8> %aa, <16 x i32> <i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
10
11  %rr1 = bitcast <16 x i8> %rr to <4 x i32>
12  ret <4 x i32> %rr1
13}
14
15define <4 x i32> @mergel_8(<4 x i32> %a, <4 x i32> %b) alwaysinline {
16entry:
17  %aa = bitcast <4 x i32> %a to <16 x i8>
18  %bb = bitcast <4 x i32> %b to <16 x i8>
19  %rr = shufflevector <16 x i8> %bb, <16 x i8> %aa, <16 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23>
20
21  %rr1 = bitcast <16 x i8> %rr to <4 x i32>
22  ret <4 x i32> %rr1
23}
24
25define void @p2s_step_ir(<4 x i32> %p0, <4 x i32> %p1, <4 x i32> %hi_mask, <8 x i16> %shift_mask, <4 x i32>* %s0, <4 x i32>* %s1) alwaysinline {
26entry:
27  %f0 = call <4 x i32> @srli_16(<4 x i32> %p1, <8 x i16> %shift_mask)
28  %t0 = call <4 x i32> @ifh_1(<4 x i32> %hi_mask, <4 x i32> %p0, <4 x i32> %f0)
29  %f1 = call <4 x i32> @slli_16(<4 x i32> %p0, <8 x i16> %shift_mask)
30  %t1 = call <4 x i32> @ifh_1(<4 x i32> %hi_mask, <4 x i32> %f1, <4 x i32> %p1)
31
32  %r0 = call <4 x i32> @mergeh_8(<4 x i32> %t0, <4 x i32> %t1)
33  %r1 = call <4 x i32> @mergel_8(<4 x i32> %t0, <4 x i32> %t1)
34
35  store <4 x i32> %r0, <4 x i32>* %s0
36  store <4 x i32> %r1, <4 x i32>* %s1
37
38  ret void
39}
Note: See TracBrowser for help on using the repository browser.