@@ -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: Loop iterations exceed bitwidth of result
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
@@ -601,7 +629,7 @@ exit: ; preds = %loop
601
629
define i16 @not.crc.wrong.sb.check.const (i8 %msg , i16 %checksum ) {
602
630
; CHECK-LABEL: 'not.crc.wrong.sb.check.const'
603
631
; CHECK-NEXT: Did not find a hash algorithm
604
- ; CHECK-NEXT: Reason: Simple recurrence doesn't use conditional recurrence with XOR
632
+ ; CHECK-NEXT: Reason: Bad RHS of significant-bit-check
605
633
;
606
634
entry:
607
635
br label %loop
@@ -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,10 +865,37 @@ 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: Expected bottom 8 bits zero (????????00001011)
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
844
- ; CHECK-NEXT: Reason: Simple recurrence doesn't use conditional recurrence with XOR
898
+ ; CHECK-NEXT: Reason: Recurrences not intertwined with XOR
845
899
;
846
900
entry:
847
901
br label %loop
@@ -869,7 +923,7 @@ exit: ; preds = %loop
869
923
define i16 @not.crc.dead.msg.no.use (i8 %msg , i16 %checksum ) {
870
924
; CHECK-LABEL: 'not.crc.dead.msg.no.use'
871
925
; CHECK-NEXT: Did not find a hash algorithm
872
- ; CHECK-NEXT: Reason: Simple recurrence doesn't use conditional recurrence with XOR
926
+ ; CHECK-NEXT: Reason: Recurrences have stray uses
873
927
;
874
928
entry:
875
929
br label %loop
@@ -898,7 +952,7 @@ exit: ; preds = %loop
898
952
define i32 @not.crc.dead.msg.wrong.op (i32 %checksum , i32 %msg ) {
899
953
; CHECK-LABEL: 'not.crc.dead.msg.wrong.op'
900
954
; CHECK-NEXT: Did not find a hash algorithm
901
- ; CHECK-NEXT: Reason: Simple recurrence doesn't use conditional recurrence with XOR
955
+ ; CHECK-NEXT: Reason: Recurrences not intertwined with XOR
902
956
;
903
957
entry:
904
958
br label %loop
@@ -922,6 +976,120 @@ exit: ; preds = %loop
922
976
ret i32 %crc.next
923
977
}
924
978
979
+ define i16 @not.crc.dead.msg.xor.notin.select.chain (i16 %msg , i16 %checksum ) {
980
+ ; CHECK-LABEL: 'not.crc.dead.msg.xor.notin.select.chain'
981
+ ; CHECK-NEXT: Did not find a hash algorithm
982
+ ; CHECK-NEXT: Reason: Recurrences have stray uses
983
+ ;
984
+ entry:
985
+ br label %loop
986
+
987
+ loop: ; preds = %loop, %entry
988
+ %iv = phi i8 [ 0 , %entry ], [ %iv.next , %loop ]
989
+ %crc = phi i16 [ %checksum , %entry ], [ %crc.next , %loop ]
990
+ %data = phi i16 [ %msg , %entry ], [ %data.next , %loop ]
991
+ %xor.crc.data = xor i16 %crc , %data
992
+ %or.crc.data = or i16 %crc , %data
993
+ %and.crc.data = and i16 %or.crc.data , 1
994
+ %data.next = lshr i16 %data , 1
995
+ %check.sb = icmp eq i16 %and.crc.data , 0
996
+ %crc.lshr = lshr i16 %crc , 1
997
+ %crc.xor = xor i16 %crc.lshr , -24575
998
+ %crc.next = select i1 %check.sb , i16 %crc.lshr , i16 %crc.xor
999
+ %iv.next = add nuw nsw i8 %iv , 1
1000
+ %exit.cond = icmp samesign ult i8 %iv , 15
1001
+ br i1 %exit.cond , label %loop , label %exit
1002
+
1003
+ exit: ; preds = %loop
1004
+ ret i16 %crc.next
1005
+ }
1006
+
1007
+ define i16 @not.crc.bad.xor.crc.data (i16 %msg , i16 %checksum ) {
1008
+ ; CHECK-LABEL: 'not.crc.bad.xor.crc.data'
1009
+ ; CHECK-NEXT: Did not find a hash algorithm
1010
+ ; CHECK-NEXT: Reason: Recurrences have stray uses
1011
+ ;
1012
+ entry:
1013
+ br label %loop
1014
+
1015
+ loop: ; preds = %loop, %entry
1016
+ %iv = phi i8 [ 0 , %entry ], [ %iv.next , %loop ]
1017
+ %crc = phi i16 [ %checksum , %entry ], [ %crc.next , %loop ]
1018
+ %data = phi i16 [ %msg , %entry ], [ %data.next , %loop ]
1019
+ %xor.crc.data = xor i16 %crc , %data
1020
+ %mul.corrupt = mul i16 %xor.crc.data , 0
1021
+ %xor.crc.data.corrupt = xor i16 %mul.corrupt , %crc
1022
+ %and.crc.data = and i16 %xor.crc.data.corrupt , 1
1023
+ %data.next = lshr i16 %data , 1
1024
+ %check.sb = icmp eq i16 %and.crc.data , 0
1025
+ %crc.lshr = lshr i16 %crc , 1
1026
+ %crc.xor = xor i16 %crc.lshr , -24575
1027
+ %crc.next = select i1 %check.sb , i16 %crc.lshr , i16 %crc.xor
1028
+ %iv.next = add nuw nsw i8 %iv , 1
1029
+ %exit.cond = icmp samesign ult i8 %iv , 15
1030
+ br i1 %exit.cond , label %loop , label %exit
1031
+
1032
+ exit: ; preds = %loop
1033
+ ret i16 %crc.next
1034
+ }
1035
+
1036
+ define i16 @not.crc.dead.msg.or.zero (i16 %msg , i16 %checksum ) {
1037
+ ; CHECK-LABEL: 'not.crc.dead.msg.or.zero'
1038
+ ; CHECK-NEXT: Did not find a hash algorithm
1039
+ ; CHECK-NEXT: Reason: Recurrences have stray uses
1040
+ ;
1041
+ entry:
1042
+ br label %loop
1043
+
1044
+ loop: ; preds = %loop, %entry
1045
+ %iv = phi i8 [ 0 , %entry ], [ %iv.next , %loop ]
1046
+ %crc = phi i16 [ %checksum , %entry ], [ %crc.next , %loop ]
1047
+ %data = phi i16 [ %msg , %entry ], [ %data.next , %loop ]
1048
+ %xor.crc.data = xor i16 %crc , %data
1049
+ %mul.corrupt = mul i16 %xor.crc.data , 0
1050
+ %or.crc.data.corrupt = or i16 %mul.corrupt , %crc
1051
+ %and.crc.data = and i16 %or.crc.data.corrupt , 1
1052
+ %data.next = lshr i16 %data , 1
1053
+ %check.sb = icmp eq i16 %and.crc.data , 0
1054
+ %crc.lshr = lshr i16 %crc , 1
1055
+ %crc.xor = xor i16 %crc.lshr , -24575
1056
+ %crc.next = select i1 %check.sb , i16 %crc.lshr , i16 %crc.xor
1057
+ %iv.next = add nuw nsw i8 %iv , 1
1058
+ %exit.cond = icmp samesign ult i8 %iv , 15
1059
+ br i1 %exit.cond , label %loop , label %exit
1060
+
1061
+ exit: ; preds = %loop
1062
+ ret i16 %crc.next
1063
+ }
1064
+
1065
+ define i16 @not.crc.unknown.value (i16 %msg , i16 %checksum , i16 %corrupt ) {
1066
+ ; CHECK-LABEL: 'not.crc.unknown.value'
1067
+ ; CHECK-NEXT: Did not find a hash algorithm
1068
+ ; CHECK-NEXT: Reason: Unknown Value
1069
+ ;
1070
+ entry:
1071
+ br label %loop
1072
+
1073
+ loop: ; preds = %loop, %entry
1074
+ %iv = phi i8 [ 0 , %entry ], [ %iv.next , %loop ]
1075
+ %crc = phi i16 [ %checksum , %entry ], [ %crc.next , %loop ]
1076
+ %data = phi i16 [ %msg , %entry ], [ %data.next , %loop ]
1077
+ %xor.crc.data = xor i16 %crc , %data
1078
+ %xor.crc.data.corrupt = mul i16 %xor.crc.data , %corrupt
1079
+ %and.crc.data = and i16 %xor.crc.data.corrupt , 1
1080
+ %data.next = lshr i16 %data , 1
1081
+ %check.sb = icmp eq i16 %and.crc.data , 0
1082
+ %crc.lshr = lshr i16 %crc , 1
1083
+ %crc.xor = xor i16 %crc.lshr , -24575
1084
+ %crc.next = select i1 %check.sb , i16 %crc.lshr , i16 %crc.xor
1085
+ %iv.next = add nuw nsw i8 %iv , 1
1086
+ %exit.cond = icmp samesign ult i8 %iv , 15
1087
+ br i1 %exit.cond , label %loop , label %exit
1088
+
1089
+ exit: ; preds = %loop
1090
+ ret i16 %crc.next
1091
+ }
1092
+
925
1093
define i16 @not.crc.float.simple.recurrence (float %msg , i16 %checksum ) {
926
1094
; CHECK-LABEL: 'not.crc.float.simple.recurrence'
927
1095
; CHECK-NEXT: Did not find a hash algorithm
0 commit comments