1 ; RUN: llc -march=hexagon < %s | FileCheck %s
2 ; RUN: llc -march=hexagon -verify-machineinstrs=true < %s | FileCheck %s
3 ; Test these 5 bitreverse store intrinsics:
4 ; Q6_bitrev_store_update_D(inputLR, pDelay, nConvLength);
5 ; Q6_bitrev_store_update_W(inputLR, pDelay, nConvLength);
6 ; Q6_bitrev_store_update_HL(inputLR, pDelay, nConvLength);
7 ; Q6_bitrev_store_update_HH(inputLR, pDelay, nConvLength);
8 ; Q6_bitrev_store_update_B(inputLR, pDelay, nConvLength);
9 ; producing these instructions:
10 ; memd(r0++m0:brev) = r1:0
11 ; memw(r0++m0:brev) = r0
12 ; memh(r0++m0:brev) = r3
13 ; memh(r0++m0:brev) = r3.h
14 ; memb(r0++m0:brev) = r3
16 ; ModuleID = 'brev_st.i'
17 target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a0:0-n16:32"
18 target triple = "hexagon"
20 define i64 @foo(i16 zeroext %filtMemLen, ptr %filtMemLR, i16 signext %filtMemIndex) nounwind {
22 %conv = zext i16 %filtMemLen to i32
23 %shr2 = lshr i32 %conv, 1
24 %idxprom = sext i16 %filtMemIndex to i32
25 %arrayidx = getelementptr inbounds i16, ptr %filtMemLR, i32 %idxprom
26 %sub = sub i32 13, %shr2
27 %shl = shl i32 1, %sub
28 ; CHECK: memd(r{{[0-9]*}}++m{{[0-1]}}:brev)
29 %0 = tail call ptr @llvm.hexagon.S2.storerd.pbr(ptr %arrayidx, i64 undef, i32 %shl)
33 declare ptr @llvm.hexagon.S2.storerd.pbr(ptr, i64, i32) nounwind
35 define i32 @foo1(i16 zeroext %filtMemLen, ptr %filtMemLR, i16 signext %filtMemIndex) nounwind {
37 %conv = zext i16 %filtMemLen to i32
38 %shr1 = lshr i32 %conv, 1
39 %idxprom = sext i16 %filtMemIndex to i32
40 %arrayidx = getelementptr inbounds i16, ptr %filtMemLR, i32 %idxprom
41 %sub = sub i32 14, %shr1
42 %shl = shl i32 1, %sub
43 ; CHECK: memw(r{{[0-9]*}}++m{{[0-1]}}:brev)
44 %0 = tail call ptr @llvm.hexagon.S2.storeri.pbr(ptr %arrayidx, i32 undef, i32 %shl)
48 declare ptr @llvm.hexagon.S2.storeri.pbr(ptr, i32, i32) nounwind
50 define signext i16 @foo2(i16 zeroext %filtMemLen, ptr %filtMemLR, i16 signext %filtMemIndex) nounwind {
52 %conv = zext i16 %filtMemLen to i32
53 %shr2 = lshr i32 %conv, 1
54 %idxprom = sext i16 %filtMemIndex to i32
55 %arrayidx = getelementptr inbounds i16, ptr %filtMemLR, i32 %idxprom
56 %sub = sub i32 15, %shr2
57 %shl = shl i32 1, %sub
58 ; CHECK: memh(r{{[0-9]*}}++m{{[0-1]}}:brev)
59 %0 = tail call ptr @llvm.hexagon.S2.storerh.pbr(ptr %arrayidx, i32 0, i32 %shl)
63 declare ptr @llvm.hexagon.S2.storerh.pbr(ptr, i32, i32) nounwind
65 define signext i16 @foo3(i16 zeroext %filtMemLen, ptr %filtMemLR, i16 signext %filtMemIndex) nounwind {
67 %conv = zext i16 %filtMemLen to i32
68 %shr2 = lshr i32 %conv, 1
69 %idxprom = sext i16 %filtMemIndex to i32
70 %arrayidx = getelementptr inbounds i16, ptr %filtMemLR, i32 %idxprom
71 %sub = sub i32 15, %shr2
72 %shl = shl i32 1, %sub
73 ; CHECK: memh(r{{[0-9]*}}++m{{[0-1]}}:brev) = r{{[0-9]*}}.h
74 %0 = tail call ptr @llvm.hexagon.S2.storerf.pbr(ptr %arrayidx, i32 0, i32 %shl)
78 declare ptr @llvm.hexagon.S2.storerf.pbr(ptr, i32, i32) nounwind
80 define zeroext i8 @foo5(i16 zeroext %filtMemLen, ptr %filtMemLR, i16 signext %filtMemIndex) nounwind {
82 %conv = zext i16 %filtMemLen to i32
83 %shr2 = lshr i32 %conv, 1
84 %idxprom = sext i16 %filtMemIndex to i32
85 %arrayidx = getelementptr inbounds i16, ptr %filtMemLR, i32 %idxprom
86 %sub = sub nsw i32 16, %shr2
87 ; CHECK: memb(r{{[0-9]*}}++m{{[0-1]}}:brev)
88 %shl = shl i32 1, %sub
89 %0 = tail call ptr @llvm.hexagon.S2.storerb.pbr(ptr %arrayidx, i32 0, i32 %shl)
93 declare ptr @llvm.hexagon.S2.storerb.pbr(ptr, i32, i32) nounwind
95 !0 = !{!"omnipotent char", !1}
96 !1 = !{!"Simple C/C++ TBAA"}