Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / catch-implicit-signed-integer-truncation-or-sign-change-CompoundAssignOperator.c
blob34ffc8bf56a44406c84506f4a063e69b70542491
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK
3 // RUN: %clang_cc1 -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
4 // RUN: %clang_cc1 -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-RECOVER
5 // RUN: %clang_cc1 -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-trap=implicit-signed-integer-truncation,implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
7 // LHS can be of 2 types: unsigned char and signed char
8 // RHS can be of 4 types: unsigned char, signed char, unsigned int, signed int.
9 // Therefore there are total of 8 tests per group.
11 // Also there are total of 10 compound operators (+=, -=, *=, /=, %=, <<=, >>=, &=, ^=, |=)
13 // CHECK-SANITIZE-ANYRECOVER: @[[INT:.*]] = {{.*}} c"'int'\00" }
14 // CHECK-SANITIZE-ANYRECOVER: @[[UNSIGNED_CHAR:.*]] = {{.*}} c"'unsigned char'\00" }
15 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
16 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
17 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
18 // CHECK-SANITIZE-ANYRECOVER: @[[SIGNED_CHAR:.*]] = {{.*}} c"'signed char'\00" }
19 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
20 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
21 // CHECK-SANITIZE-ANYRECOVER: @[[UNSIGNED_INT:.*]] = {{.*}} c"'unsigned int'\00" }
22 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_700_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 700, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
23 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
25 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 900, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
26 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
27 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
28 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1300, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
29 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
30 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1500_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 1500, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
31 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
33 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1700, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
34 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
35 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
36 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2100, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
37 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
38 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2300_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 2300, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
39 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
41 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2500, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
42 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
43 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
44 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2900, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
45 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
46 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3100_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 3100, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
47 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
49 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
50 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
51 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
52 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
53 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
54 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3900_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 3900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
55 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
57 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
58 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
59 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
60 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
61 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
62 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
63 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
64 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
66 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4900, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
67 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
68 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
69 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
70 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5300, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
71 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
72 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
73 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
75 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5700, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
76 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
77 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
78 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6100, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
79 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
80 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6300_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 6300, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
81 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
83 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6500, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
84 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
85 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
86 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6900, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
87 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
88 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7100_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 7100, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
89 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
91 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
92 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
93 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
94 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
95 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
96 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7900_SIGNED_TRUNCATION_OR_SIGN_CHANGE:.*]] = {{.*}}, i32 7900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 4, i32 0 }
97 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_8000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 8000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
99 //----------------------------------------------------------------------------//
100 // Compound add operator. //
101 //----------------------------------------------------------------------------//
103 // CHECK-LABEL: @unsigned_char_add_signed_char_unsigned_char
104 void unsigned_char_add_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
105 // CHECK: {
106 // CHECK-NEXT: entry:
107 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
108 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
109 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
110 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
111 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
112 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
113 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
114 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
115 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
116 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHSEXT]]
117 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
118 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
119 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
120 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
121 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
122 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
123 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
124 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
125 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
126 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
127 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
128 // CHECK-SANITIZE: [[CONT]]:
129 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
130 // CHECK-NEXT: ret void
131 // CHECK-NEXT: }
132 #line 100
133 (*LHS) += RHS;
136 // CHECK-LABEL: @unsigned_char_add_signed_char_signed_char
137 void unsigned_char_add_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
138 // CHECK: {
139 // CHECK-NEXT: entry:
140 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
141 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
142 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
143 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
144 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
145 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
146 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
147 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
148 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
149 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHSEXT]]
150 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
151 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
152 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
153 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
154 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
155 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
156 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
157 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
158 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
159 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
160 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
161 // CHECK-SANITIZE: [[CONT]]:
162 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
163 // CHECK-NEXT: ret void
164 // CHECK-NEXT: }
165 #line 200
166 (*LHS) += RHS;
169 // CHECK-LABEL: @unsigned_char_add_signed_char_unsigned_int
170 void unsigned_char_add_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
171 #line 300
172 (*LHS) += RHS;
175 // CHECK-LABEL: @unsigned_char_add_signed_char_signed_int
176 void unsigned_char_add_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
177 // CHECK: {
178 // CHECK-NEXT: entry:
179 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
180 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
181 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
182 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
183 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
184 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
185 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
186 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
187 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHS]]
188 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
189 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
190 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
191 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
192 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
193 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
194 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
195 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
196 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
197 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
198 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
199 // CHECK-SANITIZE: [[CONT]]:
200 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
201 // CHECK-NEXT: ret void
202 // CHECK-NEXT: }
203 #line 400
204 (*LHS) += RHS;
207 // CHECK-LABEL: @signed_char_add_unsigned_char
208 void signed_char_add_unsigned_char(signed char *LHS, unsigned char RHS) {
209 // CHECK: {
210 // CHECK-NEXT: entry:
211 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
212 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
213 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
214 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
215 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
216 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
217 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
218 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
219 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
220 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHSEXT]]
221 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
222 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
223 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
224 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
225 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
226 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
227 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
228 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
229 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
230 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
231 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
232 // CHECK-SANITIZE: [[CONT]]:
233 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
234 // CHECK-NEXT: ret void
235 // CHECK-NEXT: }
236 #line 500
237 (*LHS) += RHS;
240 // CHECK-LABEL: @signed_char_add_signed_char
241 void signed_char_add_signed_char(signed char *LHS, signed char RHS) {
242 // CHECK: {
243 // CHECK-NEXT: entry:
244 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
245 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
246 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
247 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
248 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
249 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
250 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
251 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
252 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
253 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHSEXT]]
254 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
255 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
256 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
257 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
258 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
259 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
260 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
261 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
262 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
263 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
264 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
265 // CHECK-SANITIZE: [[CONT]]:
266 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
267 // CHECK-NEXT: ret void
268 // CHECK-NEXT: }
269 #line 600
270 (*LHS) += RHS;
273 // CHECK-LABEL: @signed_char_add_signed_char_unsigned_int
274 void signed_char_add_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
275 // CHECK: {
276 // CHECK-NEXT: entry:
277 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
278 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
279 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
280 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
281 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
282 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
283 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
284 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
285 // CHECK-NEXT: %[[SRC:.*]] = add i32 %[[LHSEXT]], %[[RHS]]
286 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
287 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
288 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
289 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
290 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
291 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
292 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
293 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
294 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
295 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
296 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_700_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
297 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_700_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
298 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
299 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
300 // CHECK-SANITIZE: [[CONT]]:
301 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
302 // CHECK-NEXT: ret void
303 // CHECK-NEXT: }
304 #line 700
305 (*LHS) += RHS;
308 // CHECK-LABEL: @signed_char_add_signed_char_signed_int
309 void signed_char_add_signed_char_signed_int(signed char *LHS, signed int RHS) {
310 // CHECK: {
311 // CHECK-NEXT: entry:
312 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
313 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
314 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
315 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
316 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
317 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
318 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
319 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
320 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHS]]
321 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
322 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
323 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
324 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
325 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
326 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
327 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
328 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
329 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
330 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
331 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
332 // CHECK-SANITIZE: [[CONT]]:
333 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
334 // CHECK-NEXT: ret void
335 // CHECK-NEXT: }
336 #line 800
337 (*LHS) += RHS;
340 //----------------------------------------------------------------------------//
341 // Compound subtract operator. //
342 //----------------------------------------------------------------------------//
344 // CHECK-LABEL: @unsigned_char_sub_signed_char_unsigned_char
345 void unsigned_char_sub_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
346 // CHECK: {
347 // CHECK-NEXT: entry:
348 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
349 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
350 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
351 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
352 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
353 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
354 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
355 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
356 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
357 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
358 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
359 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
360 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
361 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
362 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
363 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
364 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
365 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
366 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
367 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
368 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
369 // CHECK-SANITIZE: [[CONT]]:
370 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
371 // CHECK-NEXT: ret void
372 // CHECK-NEXT: }
373 #line 900
374 (*LHS) -= RHS;
377 // CHECK-LABEL: @unsigned_char_sub_signed_char_signed_char
378 void unsigned_char_sub_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
379 // CHECK: {
380 // CHECK-NEXT: entry:
381 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
382 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
383 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
384 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
385 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
386 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
387 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
388 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
389 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
390 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
391 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
392 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
393 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
394 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
395 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
396 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
397 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
398 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
399 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
400 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
401 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
402 // CHECK-SANITIZE: [[CONT]]:
403 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
404 // CHECK-NEXT: ret void
405 // CHECK-NEXT: }
406 #line 1000
407 (*LHS) -= RHS;
410 // CHECK-LABEL: @unsigned_char_sub_signed_char_unsigned_int
411 void unsigned_char_sub_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
412 #line 1100
413 (*LHS) -= RHS;
416 // CHECK-LABEL: @unsigned_char_sub_signed_char_signed_int
417 void unsigned_char_sub_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
418 // CHECK: {
419 // CHECK-NEXT: entry:
420 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
421 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
422 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
423 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
424 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
425 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
426 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
427 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
428 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHS]]
429 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
430 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
431 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
432 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
433 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
434 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
435 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
436 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
437 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
438 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
439 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
440 // CHECK-SANITIZE: [[CONT]]:
441 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
442 // CHECK-NEXT: ret void
443 // CHECK-NEXT: }
444 #line 1200
445 (*LHS) -= RHS;
448 // CHECK-LABEL: @signed_char_sub_unsigned_char
449 void signed_char_sub_unsigned_char(signed char *LHS, unsigned char RHS) {
450 // CHECK: {
451 // CHECK-NEXT: entry:
452 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
453 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
454 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
455 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
456 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
457 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
458 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
459 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
460 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
461 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
462 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
463 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
464 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
465 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
466 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
467 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
468 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
469 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
470 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
471 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
472 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
473 // CHECK-SANITIZE: [[CONT]]:
474 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
475 // CHECK-NEXT: ret void
476 // CHECK-NEXT: }
477 #line 1300
478 (*LHS) -= RHS;
481 // CHECK-LABEL: @signed_char_sub_signed_char
482 void signed_char_sub_signed_char(signed char *LHS, signed char RHS) {
483 // CHECK: {
484 // CHECK-NEXT: entry:
485 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
486 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
487 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
488 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
489 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
490 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
491 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
492 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
493 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
494 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
495 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
496 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
497 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
498 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
499 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
500 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
501 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
502 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
503 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
504 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
505 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
506 // CHECK-SANITIZE: [[CONT]]:
507 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
508 // CHECK-NEXT: ret void
509 // CHECK-NEXT: }
510 #line 1400
511 (*LHS) -= RHS;
514 // CHECK-LABEL: @signed_char_sub_signed_char_unsigned_int
515 void signed_char_sub_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
516 // CHECK: {
517 // CHECK-NEXT: entry:
518 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
519 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
520 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
521 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
522 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
523 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
524 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
525 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
526 // CHECK-NEXT: %[[SRC:.*]] = sub i32 %[[LHSEXT]], %[[RHS]]
527 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
528 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
529 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
530 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
531 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
532 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
533 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
534 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
535 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
536 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
537 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1500_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
538 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1500_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
539 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
540 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
541 // CHECK-SANITIZE: [[CONT]]:
542 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
543 // CHECK-NEXT: ret void
544 // CHECK-NEXT: }
545 #line 1500
546 (*LHS) -= RHS;
549 // CHECK-LABEL: @signed_char_sub_signed_char_signed_int
550 void signed_char_sub_signed_char_signed_int(signed char *LHS, signed int RHS) {
551 // CHECK: {
552 // CHECK-NEXT: entry:
553 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
554 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
555 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
556 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
557 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
558 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
559 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
560 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
561 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHS]]
562 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
563 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
564 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
565 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
566 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
567 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
568 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
569 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
570 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
571 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
572 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
573 // CHECK-SANITIZE: [[CONT]]:
574 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
575 // CHECK-NEXT: ret void
576 // CHECK-NEXT: }
577 #line 1600
578 (*LHS) -= RHS;
581 //----------------------------------------------------------------------------//
582 // Compound multiply operator. //
583 //----------------------------------------------------------------------------//
585 // CHECK-LABEL: @unsigned_char_mul_signed_char_unsigned_char
586 void unsigned_char_mul_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
587 // CHECK: {
588 // CHECK-NEXT: entry:
589 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
590 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
591 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
592 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
593 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
594 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
595 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
596 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
597 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
598 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
599 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
600 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
601 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
602 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
603 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
604 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
605 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
606 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
607 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
608 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
609 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
610 // CHECK-SANITIZE: [[CONT]]:
611 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
612 // CHECK-NEXT: ret void
613 // CHECK-NEXT: }
614 #line 1700
615 (*LHS) *= RHS;
618 // CHECK-LABEL: @unsigned_char_mul_signed_char_signed_char
619 void unsigned_char_mul_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
620 // CHECK: {
621 // CHECK-NEXT: entry:
622 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
623 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
624 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
625 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
626 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
627 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
628 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
629 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
630 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
631 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
632 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
633 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
634 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
635 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
636 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
637 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
638 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
639 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
640 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
641 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
642 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
643 // CHECK-SANITIZE: [[CONT]]:
644 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
645 // CHECK-NEXT: ret void
646 // CHECK-NEXT: }
647 #line 1800
648 (*LHS) *= RHS;
651 // CHECK-LABEL: @unsigned_char_mul_signed_char_unsigned_int
652 void unsigned_char_mul_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
653 #line 1900
654 (*LHS) *= RHS;
657 // CHECK-LABEL: @unsigned_char_mul_signed_char_signed_int
658 void unsigned_char_mul_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
659 // CHECK: {
660 // CHECK-NEXT: entry:
661 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
662 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
663 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
664 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
665 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
666 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
667 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
668 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
669 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHS]]
670 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
671 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
672 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
673 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
674 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
675 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
676 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
677 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
678 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
679 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
680 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
681 // CHECK-SANITIZE: [[CONT]]:
682 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
683 // CHECK-NEXT: ret void
684 // CHECK-NEXT: }
685 #line 2000
686 (*LHS) *= RHS;
689 // CHECK-LABEL: @signed_char_mul_unsigned_char
690 void signed_char_mul_unsigned_char(signed char *LHS, unsigned char RHS) {
691 // CHECK: {
692 // CHECK-NEXT: entry:
693 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
694 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
695 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
696 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
697 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
698 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
699 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
700 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
701 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
702 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
703 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
704 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
705 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
706 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
707 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
708 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
709 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
710 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
711 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
712 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
713 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
714 // CHECK-SANITIZE: [[CONT]]:
715 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
716 // CHECK-NEXT: ret void
717 // CHECK-NEXT: }
718 #line 2100
719 (*LHS) *= RHS;
722 // CHECK-LABEL: @signed_char_mul_signed_char
723 void signed_char_mul_signed_char(signed char *LHS, signed char RHS) {
724 // CHECK: {
725 // CHECK-NEXT: entry:
726 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
727 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
728 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
729 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
730 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
731 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
732 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
733 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
734 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
735 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
736 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
737 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
738 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
739 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
740 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
741 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
742 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
743 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
744 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
745 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
746 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
747 // CHECK-SANITIZE: [[CONT]]:
748 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
749 // CHECK-NEXT: ret void
750 // CHECK-NEXT: }
751 #line 2200
752 (*LHS) *= RHS;
755 // CHECK-LABEL: @signed_char_mul_signed_char_unsigned_int
756 void signed_char_mul_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
757 // CHECK: {
758 // CHECK-NEXT: entry:
759 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
760 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
761 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
762 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
763 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
764 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
765 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
766 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
767 // CHECK-NEXT: %[[SRC:.*]] = mul i32 %[[LHSEXT]], %[[RHS]]
768 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
769 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
770 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
771 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
772 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
773 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
774 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
775 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
776 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
777 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
778 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2300_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
779 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2300_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
780 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
781 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
782 // CHECK-SANITIZE: [[CONT]]:
783 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
784 // CHECK-NEXT: ret void
785 // CHECK-NEXT: }
786 #line 2300
787 (*LHS) *= RHS;
790 // CHECK-LABEL: @signed_char_mul_signed_char_signed_int
791 void signed_char_mul_signed_char_signed_int(signed char *LHS, signed int RHS) {
792 // CHECK: {
793 // CHECK-NEXT: entry:
794 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
795 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
796 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
797 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
798 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
799 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
800 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
801 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
802 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHS]]
803 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
804 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
805 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
806 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
807 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
808 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
809 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
810 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
811 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
812 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
813 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
814 // CHECK-SANITIZE: [[CONT]]:
815 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
816 // CHECK-NEXT: ret void
817 // CHECK-NEXT: }
818 #line 2400
819 (*LHS) *= RHS;
822 //----------------------------------------------------------------------------//
823 // Compound divide operator. //
824 //----------------------------------------------------------------------------//
826 // CHECK-LABEL: @unsigned_char_div_signed_char_unsigned_char
827 void unsigned_char_div_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
828 // CHECK: {
829 // CHECK-NEXT: entry:
830 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
831 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
832 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
833 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
834 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
835 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
836 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
837 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
838 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
839 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
840 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
841 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
842 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
843 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
844 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
845 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
846 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
847 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
848 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
849 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
850 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
851 // CHECK-SANITIZE: [[CONT]]:
852 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
853 // CHECK-NEXT: ret void
854 // CHECK-NEXT: }
855 #line 2500
856 (*LHS) /= RHS;
859 // CHECK-LABEL: @unsigned_char_div_signed_char_signed_char
860 void unsigned_char_div_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
861 // CHECK: {
862 // CHECK-NEXT: entry:
863 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
864 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
865 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
866 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
867 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
868 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
869 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
870 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
871 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
872 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
873 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
874 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
875 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
876 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
877 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
878 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
879 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
880 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
881 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
882 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
883 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
884 // CHECK-SANITIZE: [[CONT]]:
885 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
886 // CHECK-NEXT: ret void
887 // CHECK-NEXT: }
888 #line 2600
889 (*LHS) /= RHS;
892 // CHECK-LABEL: @unsigned_char_div_signed_char_unsigned_int
893 void unsigned_char_div_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
894 #line 2700
895 (*LHS) /= RHS;
898 // CHECK-LABEL: @unsigned_char_div_signed_char_signed_int
899 void unsigned_char_div_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
900 // CHECK: {
901 // CHECK-NEXT: entry:
902 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
903 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
904 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
905 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
906 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
907 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
908 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
909 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
910 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHS]]
911 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
912 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
913 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
914 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
915 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
916 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
917 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
918 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
919 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
920 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
921 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
922 // CHECK-SANITIZE: [[CONT]]:
923 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
924 // CHECK-NEXT: ret void
925 // CHECK-NEXT: }
926 #line 2800
927 (*LHS) /= RHS;
930 // CHECK-LABEL: @signed_char_div_unsigned_char
931 void signed_char_div_unsigned_char(signed char *LHS, unsigned char RHS) {
932 // CHECK: {
933 // CHECK-NEXT: entry:
934 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
935 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
936 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
937 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
938 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
939 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
940 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
941 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
942 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
943 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
944 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
945 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
946 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
947 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
948 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
949 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
950 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
951 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
952 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
953 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
954 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
955 // CHECK-SANITIZE: [[CONT]]:
956 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
957 // CHECK-NEXT: ret void
958 // CHECK-NEXT: }
959 #line 2900
960 (*LHS) /= RHS;
963 // CHECK-LABEL: @signed_char_div_signed_char
964 void signed_char_div_signed_char(signed char *LHS, signed char RHS) {
965 // CHECK: {
966 // CHECK-NEXT: entry:
967 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
968 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
969 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
970 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
971 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
972 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
973 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
974 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
975 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
976 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
977 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
978 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
979 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
980 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
981 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
982 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
983 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
984 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
985 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
986 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
987 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
988 // CHECK-SANITIZE: [[CONT]]:
989 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
990 // CHECK-NEXT: ret void
991 // CHECK-NEXT: }
992 #line 3000
993 (*LHS) /= RHS;
996 // CHECK-LABEL: @signed_char_div_signed_char_unsigned_int
997 void signed_char_div_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
998 // CHECK: {
999 // CHECK-NEXT: entry:
1000 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1001 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1002 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1003 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1004 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1005 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1006 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1007 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1008 // CHECK-NEXT: %[[SRC:.*]] = udiv i32 %[[LHSEXT]], %[[RHS]]
1009 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1010 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1011 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
1012 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1013 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1014 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
1015 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1016 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1017 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1018 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1019 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3100_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1020 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3100_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1021 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1022 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1023 // CHECK-SANITIZE: [[CONT]]:
1024 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1025 // CHECK-NEXT: ret void
1026 // CHECK-NEXT: }
1027 #line 3100
1028 (*LHS) /= RHS;
1031 // CHECK-LABEL: @signed_char_div_signed_char_signed_int
1032 void signed_char_div_signed_char_signed_int(signed char *LHS, signed int RHS) {
1033 // CHECK: {
1034 // CHECK-NEXT: entry:
1035 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1036 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1037 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1038 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1039 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1040 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1041 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1042 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1043 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHS]]
1044 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1045 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1046 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1047 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1048 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1049 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1050 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1051 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1052 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1053 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1054 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1055 // CHECK-SANITIZE: [[CONT]]:
1056 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1057 // CHECK-NEXT: ret void
1058 // CHECK-NEXT: }
1059 #line 3200
1060 (*LHS) /= RHS;
1063 //----------------------------------------------------------------------------//
1064 // Compound remainder operator. //
1065 //----------------------------------------------------------------------------//
1067 // CHECK-LABEL: @unsigned_char_rem_signed_char_unsigned_char
1068 void unsigned_char_rem_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
1069 // CHECK: {
1070 // CHECK-NEXT: entry:
1071 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1072 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1073 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1074 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1075 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1076 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1077 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1078 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1079 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1080 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1081 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1082 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1083 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1084 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1085 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1086 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1087 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1088 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1089 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1090 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1091 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1092 // CHECK-SANITIZE: [[CONT]]:
1093 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1094 // CHECK-NEXT: ret void
1095 // CHECK-NEXT: }
1096 #line 3300
1097 (*LHS) %= RHS;
1100 // CHECK-LABEL: @unsigned_char_rem_signed_char_signed_char
1101 void unsigned_char_rem_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
1102 // CHECK: {
1103 // CHECK-NEXT: entry:
1104 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1105 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1106 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1107 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1108 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1109 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1110 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1111 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1112 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1113 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1114 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1115 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1116 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1117 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1118 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1119 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1120 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1121 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1122 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1123 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1124 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1125 // CHECK-SANITIZE: [[CONT]]:
1126 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1127 // CHECK-NEXT: ret void
1128 // CHECK-NEXT: }
1129 #line 3400
1130 (*LHS) %= RHS;
1133 // CHECK-LABEL: @unsigned_char_rem_signed_char_unsigned_int
1134 void unsigned_char_rem_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
1135 #line 3500
1136 (*LHS) %= RHS;
1139 // CHECK-LABEL: @unsigned_char_rem_signed_char_signed_int
1140 void unsigned_char_rem_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
1141 // CHECK: {
1142 // CHECK-NEXT: entry:
1143 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1144 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1145 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1146 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1147 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1148 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1149 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1150 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1151 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHS]]
1152 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1153 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1154 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1155 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1156 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1157 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1158 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1159 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1160 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1161 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1162 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1163 // CHECK-SANITIZE: [[CONT]]:
1164 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1165 // CHECK-NEXT: ret void
1166 // CHECK-NEXT: }
1167 #line 3600
1168 (*LHS) %= RHS;
1171 // CHECK-LABEL: @signed_char_rem_unsigned_char
1172 void signed_char_rem_unsigned_char(signed char *LHS, unsigned char RHS) {
1173 // CHECK: {
1174 // CHECK-NEXT: entry:
1175 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1176 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1177 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1178 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1179 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1180 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1181 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1182 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1183 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1184 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1185 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1186 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1187 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1188 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1189 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1190 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1191 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1192 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1193 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1194 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1195 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1196 // CHECK-SANITIZE: [[CONT]]:
1197 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1198 // CHECK-NEXT: ret void
1199 // CHECK-NEXT: }
1200 #line 3700
1201 (*LHS) %= RHS;
1204 // CHECK-LABEL: @signed_char_rem_signed_char
1205 void signed_char_rem_signed_char(signed char *LHS, signed char RHS) {
1206 // CHECK: {
1207 // CHECK-NEXT: entry:
1208 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1209 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1210 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1211 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1212 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1213 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1214 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1215 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1216 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1217 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1218 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1219 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1220 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1221 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1222 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1223 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1224 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1225 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1226 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1227 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1228 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1229 // CHECK-SANITIZE: [[CONT]]:
1230 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1231 // CHECK-NEXT: ret void
1232 // CHECK-NEXT: }
1233 #line 3800
1234 (*LHS) %= RHS;
1237 // CHECK-LABEL: @signed_char_rem_signed_char_unsigned_int
1238 void signed_char_rem_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
1239 // CHECK: {
1240 // CHECK-NEXT: entry:
1241 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1242 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1243 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1244 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1245 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1246 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1247 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1248 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1249 // CHECK-NEXT: %[[SRC:.*]] = urem i32 %[[LHSEXT]], %[[RHS]]
1250 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1251 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1252 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
1253 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1254 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1255 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
1256 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1257 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1258 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1259 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1260 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3900_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1261 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3900_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1262 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1263 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1264 // CHECK-SANITIZE: [[CONT]]:
1265 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1266 // CHECK-NEXT: ret void
1267 // CHECK-NEXT: }
1268 #line 3900
1269 (*LHS) %= RHS;
1272 // CHECK-LABEL: @signed_char_rem_signed_char_signed_int
1273 void signed_char_rem_signed_char_signed_int(signed char *LHS, signed int RHS) {
1274 // CHECK: {
1275 // CHECK-NEXT: entry:
1276 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1277 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1278 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1279 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1280 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1281 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1282 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1283 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1284 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHS]]
1285 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1286 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1287 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1288 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1289 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1290 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1291 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1292 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1293 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1294 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1295 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1296 // CHECK-SANITIZE: [[CONT]]:
1297 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1298 // CHECK-NEXT: ret void
1299 // CHECK-NEXT: }
1300 #line 4000
1301 (*LHS) %= RHS;
1304 //----------------------------------------------------------------------------//
1305 // Compound left-shift operator. //
1306 //----------------------------------------------------------------------------//
1308 // CHECK-LABEL: @unsigned_char_shl_signed_char_unsigned_char
1309 void unsigned_char_shl_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
1310 // CHECK: {
1311 // CHECK-NEXT: entry:
1312 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1313 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1314 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1315 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1316 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1317 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1318 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1319 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1320 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1321 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1322 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1323 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1324 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1325 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1326 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1327 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1328 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1329 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1330 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1331 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1332 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1333 // CHECK-SANITIZE: [[CONT]]:
1334 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1335 // CHECK-NEXT: ret void
1336 // CHECK-NEXT: }
1337 #line 4100
1338 (*LHS) <<= RHS;
1341 // CHECK-LABEL: @unsigned_char_shl_signed_char_signed_char
1342 void unsigned_char_shl_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
1343 // CHECK: {
1344 // CHECK-NEXT: entry:
1345 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1346 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1347 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1348 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1349 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1350 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1351 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1352 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1353 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1354 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1355 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1356 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1357 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1358 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1359 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1360 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1361 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1362 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1363 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1364 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1365 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1366 // CHECK-SANITIZE: [[CONT]]:
1367 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1368 // CHECK-NEXT: ret void
1369 // CHECK-NEXT: }
1370 #line 4200
1371 (*LHS) <<= RHS;
1374 // CHECK-LABEL: @unsigned_char_shl_signed_char_unsigned_int
1375 void unsigned_char_shl_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
1376 // CHECK: {
1377 // CHECK-NEXT: entry:
1378 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1379 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1380 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1381 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1382 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1383 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1384 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1385 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1386 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1387 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1388 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1389 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1390 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1391 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1392 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1393 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1394 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1395 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1396 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1397 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1398 // CHECK-SANITIZE: [[CONT]]:
1399 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1400 // CHECK-NEXT: ret void
1401 // CHECK-NEXT: }
1402 #line 4300
1403 (*LHS) <<= RHS;
1406 // CHECK-LABEL: @unsigned_char_shl_signed_char_signed_int
1407 void unsigned_char_shl_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
1408 // CHECK: {
1409 // CHECK-NEXT: entry:
1410 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1411 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1412 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1413 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1414 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1415 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1416 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1417 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1418 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1419 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1420 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1421 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1422 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1423 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1424 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1425 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1426 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1427 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1428 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1429 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1430 // CHECK-SANITIZE: [[CONT]]:
1431 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1432 // CHECK-NEXT: ret void
1433 // CHECK-NEXT: }
1434 #line 4400
1435 (*LHS) <<= RHS;
1438 // CHECK-LABEL: @signed_char_shl_unsigned_char
1439 void signed_char_shl_unsigned_char(signed char *LHS, unsigned char RHS) {
1440 // CHECK: {
1441 // CHECK-NEXT: entry:
1442 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1443 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1444 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1445 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1446 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1447 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1448 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1449 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1450 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1451 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1452 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1453 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1454 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1455 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1456 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1457 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1458 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1459 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1460 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1461 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1462 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1463 // CHECK-SANITIZE: [[CONT]]:
1464 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1465 // CHECK-NEXT: ret void
1466 // CHECK-NEXT: }
1467 #line 4500
1468 (*LHS) <<= RHS;
1471 // CHECK-LABEL: @signed_char_shl_signed_char
1472 void signed_char_shl_signed_char(signed char *LHS, signed char RHS) {
1473 // CHECK: {
1474 // CHECK-NEXT: entry:
1475 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1476 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1477 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1478 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1479 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1480 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1481 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1482 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1483 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1484 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1485 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1486 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1487 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1488 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1489 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1490 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1491 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1492 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1493 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1494 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1495 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1496 // CHECK-SANITIZE: [[CONT]]:
1497 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1498 // CHECK-NEXT: ret void
1499 // CHECK-NEXT: }
1500 #line 4600
1501 (*LHS) <<= RHS;
1504 // CHECK-LABEL: @signed_char_shl_signed_char_unsigned_int
1505 void signed_char_shl_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
1506 // CHECK: {
1507 // CHECK-NEXT: entry:
1508 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1509 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1510 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1511 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1512 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1513 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1514 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1515 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1516 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1517 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1518 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1519 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1520 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1521 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1522 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1523 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1524 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1525 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1526 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1527 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1528 // CHECK-SANITIZE: [[CONT]]:
1529 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1530 // CHECK-NEXT: ret void
1531 // CHECK-NEXT: }
1532 #line 4700
1533 (*LHS) <<= RHS;
1536 // CHECK-LABEL: @signed_char_shl_signed_char_signed_int
1537 void signed_char_shl_signed_char_signed_int(signed char *LHS, signed int RHS) {
1538 // CHECK: {
1539 // CHECK-NEXT: entry:
1540 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1541 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1542 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1543 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1544 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1545 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1546 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1547 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1548 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1549 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1550 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1551 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1552 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1553 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1554 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1555 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1556 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1557 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1558 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1559 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1560 // CHECK-SANITIZE: [[CONT]]:
1561 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1562 // CHECK-NEXT: ret void
1563 // CHECK-NEXT: }
1564 #line 4800
1565 (*LHS) <<= RHS;
1568 //----------------------------------------------------------------------------//
1569 // Compound right-shift operator. //
1570 //----------------------------------------------------------------------------//
1572 // CHECK-LABEL: @unsigned_char_shr_signed_char_unsigned_char
1573 void unsigned_char_shr_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
1574 // CHECK: {
1575 // CHECK-NEXT: entry:
1576 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1577 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1578 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1579 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1580 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1581 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1582 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1583 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1584 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1585 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1586 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1587 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1588 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1589 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1590 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1591 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1592 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1593 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1594 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1595 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1596 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1597 // CHECK-SANITIZE: [[CONT]]:
1598 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1599 // CHECK-NEXT: ret void
1600 // CHECK-NEXT: }
1601 #line 4900
1602 (*LHS) >>= RHS;
1605 // CHECK-LABEL: @unsigned_char_shr_signed_char_signed_char
1606 void unsigned_char_shr_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
1607 // CHECK: {
1608 // CHECK-NEXT: entry:
1609 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1610 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1611 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1612 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1613 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1614 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1615 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1616 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1617 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1618 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1619 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1620 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1621 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1622 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1623 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1624 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1625 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1626 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1627 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1628 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1629 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1630 // CHECK-SANITIZE: [[CONT]]:
1631 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1632 // CHECK-NEXT: ret void
1633 // CHECK-NEXT: }
1634 #line 5000
1635 (*LHS) >>= RHS;
1638 // CHECK-LABEL: @unsigned_char_shr_signed_char_unsigned_int
1639 void unsigned_char_shr_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
1640 // CHECK: {
1641 // CHECK-NEXT: entry:
1642 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1643 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1644 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1645 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1646 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1647 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1648 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1649 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1650 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1651 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1652 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1653 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1654 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1655 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1656 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1657 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1658 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1659 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1660 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1661 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1662 // CHECK-SANITIZE: [[CONT]]:
1663 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1664 // CHECK-NEXT: ret void
1665 // CHECK-NEXT: }
1666 #line 5100
1667 (*LHS) >>= RHS;
1670 // CHECK-LABEL: @unsigned_char_shr_signed_char_signed_int
1671 void unsigned_char_shr_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
1672 // CHECK: {
1673 // CHECK-NEXT: entry:
1674 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1675 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1676 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1677 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1678 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1679 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1680 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1681 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1682 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1683 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1684 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1685 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1686 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1687 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1688 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1689 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1690 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1691 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1692 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1693 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1694 // CHECK-SANITIZE: [[CONT]]:
1695 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1696 // CHECK-NEXT: ret void
1697 // CHECK-NEXT: }
1698 #line 5200
1699 (*LHS) >>= RHS;
1702 // CHECK-LABEL: @signed_char_shr_unsigned_char
1703 void signed_char_shr_unsigned_char(signed char *LHS, unsigned char RHS) {
1704 // CHECK: {
1705 // CHECK-NEXT: entry:
1706 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1707 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1708 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1709 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1710 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1711 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1712 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1713 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1714 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1715 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1716 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1717 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1718 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1719 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1720 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1721 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1722 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1723 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1724 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1725 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1726 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1727 // CHECK-SANITIZE: [[CONT]]:
1728 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1729 // CHECK-NEXT: ret void
1730 // CHECK-NEXT: }
1731 #line 5300
1732 (*LHS) >>= RHS;
1735 // CHECK-LABEL: @signed_char_shr_signed_char
1736 void signed_char_shr_signed_char(signed char *LHS, signed char RHS) {
1737 // CHECK: {
1738 // CHECK-NEXT: entry:
1739 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1740 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1741 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1742 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1743 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1744 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1745 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1746 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1747 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1748 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1749 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1750 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1751 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1752 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1753 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1754 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1755 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1756 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1757 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1758 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1759 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1760 // CHECK-SANITIZE: [[CONT]]:
1761 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1762 // CHECK-NEXT: ret void
1763 // CHECK-NEXT: }
1764 #line 5400
1765 (*LHS) >>= RHS;
1768 // CHECK-LABEL: @signed_char_shr_signed_char_unsigned_int
1769 void signed_char_shr_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
1770 // CHECK: {
1771 // CHECK-NEXT: entry:
1772 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1773 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1774 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1775 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1776 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1777 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1778 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1779 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1780 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1781 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1782 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1783 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1784 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1785 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1786 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1787 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1788 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1789 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1790 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1791 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1792 // CHECK-SANITIZE: [[CONT]]:
1793 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1794 // CHECK-NEXT: ret void
1795 // CHECK-NEXT: }
1796 #line 5500
1797 (*LHS) >>= RHS;
1800 // CHECK-LABEL: @signed_char_shr_signed_char_signed_int
1801 void signed_char_shr_signed_char_signed_int(signed char *LHS, signed int RHS) {
1802 // CHECK: {
1803 // CHECK-NEXT: entry:
1804 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1805 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1806 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1807 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1808 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1809 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1810 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1811 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1812 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1813 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1814 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1815 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1816 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1817 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1818 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1819 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1820 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1821 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1822 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1823 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1824 // CHECK-SANITIZE: [[CONT]]:
1825 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1826 // CHECK-NEXT: ret void
1827 // CHECK-NEXT: }
1828 #line 5600
1829 (*LHS) >>= RHS;
1832 //----------------------------------------------------------------------------//
1833 // Compound and operator. //
1834 //----------------------------------------------------------------------------//
1836 // CHECK-LABEL: @unsigned_char_and_signed_char_unsigned_char
1837 void unsigned_char_and_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
1838 // CHECK: {
1839 // CHECK-NEXT: entry:
1840 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1841 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1842 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1843 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1844 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1845 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1846 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1847 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1848 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1849 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1850 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1851 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1852 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1853 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1854 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1855 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1856 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1857 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1858 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1859 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1860 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1861 // CHECK-SANITIZE: [[CONT]]:
1862 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1863 // CHECK-NEXT: ret void
1864 // CHECK-NEXT: }
1865 #line 5700
1866 (*LHS) &= RHS;
1869 // CHECK-LABEL: @unsigned_char_and_signed_char_signed_char
1870 void unsigned_char_and_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
1871 // CHECK: {
1872 // CHECK-NEXT: entry:
1873 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1874 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1875 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1876 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1877 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1878 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1879 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1880 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1881 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1882 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1883 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1884 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1885 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1886 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1887 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1888 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1889 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1890 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1891 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1892 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1893 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1894 // CHECK-SANITIZE: [[CONT]]:
1895 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1896 // CHECK-NEXT: ret void
1897 // CHECK-NEXT: }
1898 #line 5800
1899 (*LHS) &= RHS;
1902 // CHECK-LABEL: @unsigned_char_and_signed_char_unsigned_int
1903 void unsigned_char_and_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
1904 #line 5900
1905 (*LHS) &= RHS;
1908 // CHECK-LABEL: @unsigned_char_and_signed_char_signed_int
1909 void unsigned_char_and_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
1910 // CHECK: {
1911 // CHECK-NEXT: entry:
1912 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1913 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1914 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1915 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1916 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1917 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1918 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1919 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1920 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
1921 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1922 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1923 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1924 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1925 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1926 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1927 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1928 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1929 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1930 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1931 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1932 // CHECK-SANITIZE: [[CONT]]:
1933 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1934 // CHECK-NEXT: ret void
1935 // CHECK-NEXT: }
1936 #line 6000
1937 (*LHS) &= RHS;
1940 // CHECK-LABEL: @signed_char_and_unsigned_char
1941 void signed_char_and_unsigned_char(signed char *LHS, unsigned char RHS) {
1942 // CHECK: {
1943 // CHECK-NEXT: entry:
1944 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1945 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1946 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1947 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1948 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1949 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1950 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1951 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1952 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1953 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1954 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1955 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1956 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1957 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1958 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1959 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1960 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1961 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1962 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1963 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1964 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1965 // CHECK-SANITIZE: [[CONT]]:
1966 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1967 // CHECK-NEXT: ret void
1968 // CHECK-NEXT: }
1969 #line 6100
1970 (*LHS) &= RHS;
1973 // CHECK-LABEL: @signed_char_and_signed_char
1974 void signed_char_and_signed_char(signed char *LHS, signed char RHS) {
1975 // CHECK: {
1976 // CHECK-NEXT: entry:
1977 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1978 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1979 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1980 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1981 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1982 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1983 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1984 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1985 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1986 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1987 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1988 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1989 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1990 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1991 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1992 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1993 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1994 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1995 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1996 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1997 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1998 // CHECK-SANITIZE: [[CONT]]:
1999 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2000 // CHECK-NEXT: ret void
2001 // CHECK-NEXT: }
2002 #line 6200
2003 (*LHS) &= RHS;
2006 // CHECK-LABEL: @signed_char_and_signed_char_unsigned_int
2007 void signed_char_and_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
2008 // CHECK: {
2009 // CHECK-NEXT: entry:
2010 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2011 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2012 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2013 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2014 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2015 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2016 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2017 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2018 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2019 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2020 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2021 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
2022 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2023 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2024 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
2025 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2026 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2027 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2028 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2029 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6300_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2030 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6300_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2031 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2032 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2033 // CHECK-SANITIZE: [[CONT]]:
2034 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2035 // CHECK-NEXT: ret void
2036 // CHECK-NEXT: }
2037 #line 6300
2038 (*LHS) &= RHS;
2041 // CHECK-LABEL: @signed_char_and_signed_char_signed_int
2042 void signed_char_and_signed_char_signed_int(signed char *LHS, signed int RHS) {
2043 // CHECK: {
2044 // CHECK-NEXT: entry:
2045 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2046 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2047 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2048 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2049 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2050 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2051 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2052 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2053 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2054 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2055 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2056 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2057 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2058 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2059 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2060 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2061 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2062 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2063 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2064 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2065 // CHECK-SANITIZE: [[CONT]]:
2066 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2067 // CHECK-NEXT: ret void
2068 // CHECK-NEXT: }
2069 #line 6400
2070 (*LHS) &= RHS;
2073 //----------------------------------------------------------------------------//
2074 // Compound xor operator. //
2075 //----------------------------------------------------------------------------//
2077 // CHECK-LABEL: @unsigned_char_or_signed_char_unsigned_char
2078 void unsigned_char_or_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
2079 // CHECK: {
2080 // CHECK-NEXT: entry:
2081 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2082 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2083 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2084 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2085 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2086 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2087 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2088 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2089 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2090 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2091 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2092 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2093 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2094 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2095 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2096 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2097 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2098 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2099 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2100 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2101 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2102 // CHECK-SANITIZE: [[CONT]]:
2103 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2104 // CHECK-NEXT: ret void
2105 // CHECK-NEXT: }
2106 #line 6500
2107 (*LHS) |= RHS;
2110 // CHECK-LABEL: @unsigned_char_or_signed_char_signed_char
2111 void unsigned_char_or_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
2112 // CHECK: {
2113 // CHECK-NEXT: entry:
2114 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2115 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2116 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2117 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2118 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2119 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2120 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2121 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2122 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2123 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2124 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2125 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2126 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2127 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2128 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2129 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2130 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2131 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2132 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2133 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2134 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2135 // CHECK-SANITIZE: [[CONT]]:
2136 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2137 // CHECK-NEXT: ret void
2138 // CHECK-NEXT: }
2139 #line 6600
2140 (*LHS) |= RHS;
2143 // CHECK-LABEL: @unsigned_char_or_signed_char_unsigned_int
2144 void unsigned_char_or_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
2145 #line 6700
2146 (*LHS) |= RHS;
2149 // CHECK-LABEL: @unsigned_char_or_signed_char_signed_int
2150 void unsigned_char_or_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
2151 // CHECK: {
2152 // CHECK-NEXT: entry:
2153 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2154 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2155 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2156 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2157 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2158 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2159 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2160 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2161 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2162 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2163 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2164 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2165 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2166 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2167 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2168 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2169 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2170 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2171 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2172 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2173 // CHECK-SANITIZE: [[CONT]]:
2174 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2175 // CHECK-NEXT: ret void
2176 // CHECK-NEXT: }
2177 #line 6800
2178 (*LHS) |= RHS;
2181 // CHECK-LABEL: @signed_char_or_unsigned_char
2182 void signed_char_or_unsigned_char(signed char *LHS, unsigned char RHS) {
2183 // CHECK: {
2184 // CHECK-NEXT: entry:
2185 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2186 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2187 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2188 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2189 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2190 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2191 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2192 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2193 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2194 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2195 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2196 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2197 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2198 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2199 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2200 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2201 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2202 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2203 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2204 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2205 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2206 // CHECK-SANITIZE: [[CONT]]:
2207 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2208 // CHECK-NEXT: ret void
2209 // CHECK-NEXT: }
2210 #line 6900
2211 (*LHS) |= RHS;
2214 // CHECK-LABEL: @signed_char_or_signed_char
2215 void signed_char_or_signed_char(signed char *LHS, signed char RHS) {
2216 // CHECK: {
2217 // CHECK-NEXT: entry:
2218 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2219 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2220 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2221 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2222 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2223 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2224 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2225 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2226 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2227 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2228 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2229 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2230 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2231 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2232 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2233 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2234 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2235 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2236 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2237 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2238 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2239 // CHECK-SANITIZE: [[CONT]]:
2240 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2241 // CHECK-NEXT: ret void
2242 // CHECK-NEXT: }
2243 #line 7000
2244 (*LHS) |= RHS;
2247 // CHECK-LABEL: @signed_char_or_signed_char_unsigned_int
2248 void signed_char_or_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
2249 // CHECK: {
2250 // CHECK-NEXT: entry:
2251 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2252 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2253 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2254 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2255 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2256 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2257 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2258 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2259 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2260 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2261 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2262 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
2263 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2264 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2265 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
2266 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2267 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2268 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2269 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2270 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7100_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2271 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7100_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2272 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2273 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2274 // CHECK-SANITIZE: [[CONT]]:
2275 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2276 // CHECK-NEXT: ret void
2277 // CHECK-NEXT: }
2278 #line 7100
2279 (*LHS) |= RHS;
2282 // CHECK-LABEL: @signed_char_or_signed_char_signed_int
2283 void signed_char_or_signed_char_signed_int(signed char *LHS, signed int RHS) {
2284 // CHECK: {
2285 // CHECK-NEXT: entry:
2286 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2287 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2288 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2289 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2290 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2291 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2292 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2293 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2294 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2295 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2296 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2297 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2298 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2299 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2300 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2301 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2302 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2303 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2304 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2305 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2306 // CHECK-SANITIZE: [[CONT]]:
2307 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2308 // CHECK-NEXT: ret void
2309 // CHECK-NEXT: }
2310 #line 7200
2311 (*LHS) |= RHS;
2314 //----------------------------------------------------------------------------//
2315 // Compound or operator. //
2316 //----------------------------------------------------------------------------//
2318 // CHECK-LABEL: @unsigned_char_xor_signed_char_unsigned_char
2319 void unsigned_char_xor_signed_char_unsigned_char(unsigned char *LHS, unsigned char RHS) {
2320 // CHECK: {
2321 // CHECK-NEXT: entry:
2322 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2323 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2324 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2325 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2326 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2327 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2328 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2329 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2330 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2331 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2332 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2333 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2334 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2335 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2336 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2337 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2338 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2339 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2340 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2341 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2342 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2343 // CHECK-SANITIZE: [[CONT]]:
2344 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2345 // CHECK-NEXT: ret void
2346 // CHECK-NEXT: }
2347 #line 7300
2348 (*LHS) ^= RHS;
2351 // CHECK-LABEL: @unsigned_char_xor_signed_char_signed_char
2352 void unsigned_char_xor_signed_char_signed_char(unsigned char *LHS, signed char RHS) {
2353 // CHECK: {
2354 // CHECK-NEXT: entry:
2355 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2356 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2357 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2358 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2359 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2360 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2361 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2362 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2363 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2364 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2365 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2366 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2367 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2368 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2369 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2370 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2371 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2372 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2373 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2374 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2375 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2376 // CHECK-SANITIZE: [[CONT]]:
2377 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2378 // CHECK-NEXT: ret void
2379 // CHECK-NEXT: }
2380 #line 7400
2381 (*LHS) ^= RHS;
2384 // CHECK-LABEL: @unsigned_char_xor_signed_char_unsigned_int
2385 void unsigned_char_xor_signed_char_unsigned_int(unsigned char *LHS, unsigned int RHS) {
2386 #line 7500
2387 (*LHS) ^= RHS;
2390 // CHECK-LABEL: @unsigned_char_xor_signed_char_signed_int
2391 void unsigned_char_xor_signed_char_signed_int(unsigned char *LHS, signed int RHS) {
2392 // CHECK: {
2393 // CHECK-NEXT: entry:
2394 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2395 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2396 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2397 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2398 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2399 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2400 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2401 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2402 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2403 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2404 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2405 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2406 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2407 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2408 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2409 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2410 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2411 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2412 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2413 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2414 // CHECK-SANITIZE: [[CONT]]:
2415 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2416 // CHECK-NEXT: ret void
2417 // CHECK-NEXT: }
2418 #line 7600
2419 (*LHS) ^= RHS;
2422 // CHECK-LABEL: @signed_char_xor_unsigned_char
2423 void signed_char_xor_unsigned_char(signed char *LHS, unsigned char RHS) {
2424 // CHECK: {
2425 // CHECK-NEXT: entry:
2426 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2427 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2428 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2429 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2430 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2431 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2432 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2433 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2434 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2435 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2436 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2437 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2438 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2439 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2440 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2441 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2442 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2443 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2444 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2445 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2446 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2447 // CHECK-SANITIZE: [[CONT]]:
2448 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2449 // CHECK-NEXT: ret void
2450 // CHECK-NEXT: }
2451 #line 7700
2452 (*LHS) ^= RHS;
2455 // CHECK-LABEL: @signed_char_xor_signed_char
2456 void signed_char_xor_signed_char(signed char *LHS, signed char RHS) {
2457 // CHECK: {
2458 // CHECK-NEXT: entry:
2459 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2460 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2461 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2462 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2463 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2464 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2465 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2466 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2467 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2468 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2469 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2470 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2471 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2472 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2473 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2474 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2475 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2476 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2477 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2478 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2479 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2480 // CHECK-SANITIZE: [[CONT]]:
2481 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2482 // CHECK-NEXT: ret void
2483 // CHECK-NEXT: }
2484 #line 7800
2485 (*LHS) ^= RHS;
2488 // CHECK-LABEL: @signed_char_xor_signed_char_unsigned_int
2489 void signed_char_xor_signed_char_unsigned_int(signed char *LHS, unsigned int RHS) {
2490 // CHECK: {
2491 // CHECK-NEXT: entry:
2492 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2493 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2494 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2495 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2496 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2497 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2498 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2499 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2500 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2501 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2502 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2503 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
2504 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2505 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2506 // CHECK-SANITIZE-NEXT: %[[BOTHCHECKS:.*]] = and i1 %[[SIGNCHANGECHECK]], %[[TRUNCHECK]], !nosanitize
2507 // CHECK-SANITIZE-NEXT: br i1 %[[BOTHCHECKS]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2508 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2509 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2510 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2511 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7900_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2512 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7900_SIGNED_TRUNCATION_OR_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2513 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2514 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2515 // CHECK-SANITIZE: [[CONT]]:
2516 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2517 // CHECK-NEXT: ret void
2518 // CHECK-NEXT: }
2519 #line 7900
2520 (*LHS) ^= RHS;
2523 // CHECK-LABEL: @signed_char_xor_signed_char_signed_int
2524 void signed_char_xor_signed_char_signed_int(signed char *LHS, signed int RHS) {
2525 // CHECK: {
2526 // CHECK-NEXT: entry:
2527 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2528 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2529 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2530 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2531 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2532 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2533 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2534 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2535 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2536 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2537 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2538 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2539 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2540 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2541 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2542 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2543 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_8000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2544 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_8000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2545 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2546 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2547 // CHECK-SANITIZE: [[CONT]]:
2548 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2549 // CHECK-NEXT: ret void
2550 // CHECK-NEXT: }
2551 #line 8000
2552 (*LHS) ^= RHS;