@@ -144,6 +144,34 @@ exit: ; preds = %loop
144
144
ret i16 %crc.next
145
145
}
146
146
147
+ define i8 @crc8.le.tc16 (i16 %msg , i8 %checksum ) {
148
+ ; CHECK-LABEL: 'crc8.le.tc16'
149
+ ; CHECK-NEXT: Did not find a hash algorithm
150
+ ; CHECK-NEXT: Reason: Simple recurrence doesn't use conditional recurrence with XOR
151
+ ;
152
+ entry:
153
+ br label %loop
154
+
155
+ loop: ; preds = %loop, %entry
156
+ %iv = phi i8 [ 0 , %entry ], [ %iv.next , %loop ]
157
+ %crc = phi i8 [ %checksum , %entry ], [ %crc.next , %loop ]
158
+ %data = phi i16 [ %msg , %entry ], [ %data.next , %loop ]
159
+ %data.trunc = trunc i16 %data to i8
160
+ %xor.crc.data = xor i8 %crc , %data.trunc
161
+ %and.crc.data = and i8 %xor.crc.data , 1
162
+ %data.next = lshr i16 %data , 1
163
+ %check.sb = icmp eq i8 %and.crc.data , 0
164
+ %crc.lshr = lshr i8 %crc , 1
165
+ %crc.xor = xor i8 %crc.lshr , 29
166
+ %crc.next = select i1 %check.sb , i8 %crc.lshr , i8 %crc.xor
167
+ %iv.next = add nuw nsw i8 %iv , 1
168
+ %exit.cond = icmp samesign ult i8 %iv , 15
169
+ br i1 %exit.cond , label %loop , label %exit
170
+
171
+ exit: ; preds = %loop
172
+ ret i8 %crc.next
173
+ }
174
+
147
175
define i16 @crc16.be.tc8.crc.init.li (i16 %checksum , i8 %msg ) {
148
176
; CHECK-LABEL: 'crc16.be.tc8.crc.init.li'
149
177
; CHECK-NEXT: Found big-endian CRC-16 loop with trip count 8
@@ -610,9 +638,8 @@ loop: ; preds = %loop, %entry
610
638
%iv = phi i8 [ 0 , %entry ], [ %iv.next , %loop ]
611
639
%data = phi i8 [ %msg , %entry ], [ %data.next , %loop ]
612
640
%crc = phi i16 [ %checksum , %entry ], [ %crc.next , %loop ]
613
- %crc.lshr = lshr i16 %crc , 8
614
641
%data.ext = zext i8 %data to i16
615
- %xor.crc.data = xor i16 %crc.lshr , %data.ext
642
+ %xor.crc.data = xor i16 %crc , %data.ext
616
643
%check.sb = icmp samesign ult i16 %xor.crc.data , 128
617
644
%crc.shl = shl i16 %crc , 1
618
645
%crc.xor = xor i16 %crc.shl , 258
@@ -838,6 +865,33 @@ exit: ; preds = %loop
838
865
ret i16 %crc.next
839
866
}
840
867
868
+ define i16 @not.crc.bad.cast (i8 %msg , i16 %checksum ) {
869
+ ; CHECK-LABEL: 'not.crc.bad.cast'
870
+ ; CHECK-NEXT: Did not find a hash algorithm
871
+ ; CHECK-NEXT: Reason: Simple recurrence doesn't use conditional recurrence with XOR
872
+ ;
873
+ entry:
874
+ br label %loop
875
+
876
+ loop: ; preds = %loop, %entry
877
+ %iv = phi i8 [ 0 , %entry ], [ %iv.next , %loop ]
878
+ %data = phi i8 [ %msg , %entry ], [ %data.next , %loop ]
879
+ %crc = phi i16 [ %checksum , %entry ], [ %crc.next , %loop ]
880
+ %data.ext = zext i8 %data to i16
881
+ %xor.crc.data = xor i16 %crc , %data.ext
882
+ %check.sb = icmp slt i16 %xor.crc.data , 0
883
+ %crc.shl = shl i16 %crc , 1
884
+ %crc.xor = xor i16 %crc.shl , 29
885
+ %crc.next = select i1 %check.sb , i16 %crc.shl , i16 %crc.xor
886
+ %data.next = shl i8 %data , 1
887
+ %iv.next = add nuw nsw i8 %iv , 1
888
+ %exit.cond = icmp samesign ult i8 %iv , 7
889
+ br i1 %exit.cond , label %loop , label %exit
890
+
891
+ exit: ; preds = %loop
892
+ ret i16 %crc.next
893
+ }
894
+
841
895
define i32 @not.crc.dead.msg.bad.use (i32 %checksum , i32 %msg ) {
842
896
; CHECK-LABEL: 'not.crc.dead.msg.bad.use'
843
897
; CHECK-NEXT: Did not find a hash algorithm
0 commit comments