1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK
3 // RUN: %clang_cc1 -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=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-integer-sign-change -fsanitize-recover=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-integer-sign-change -fsanitize-trap=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_SIGN_CHANGE:.*]] = {{.*}}, i32 100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
16 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_200_SIGN_CHANGE:.*]] = {{.*}}, i32 200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
17 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_400_SIGN_CHANGE:.*]] = {{.*}}, i32 400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
18 // CHECK-SANITIZE-ANYRECOVER: @[[SIGNED_CHAR:.*]] = {{.*}} c"'signed char'\00" }
19 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_500_SIGN_CHANGE:.*]] = {{.*}}, i32 500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
20 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_600_SIGN_CHANGE:.*]] = {{.*}}, i32 600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
21 // CHECK-SANITIZE-ANYRECOVER: @[[UNSIGNED_INT:.*]] = {{.*}} c"'unsigned int'\00" }
22 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_700_SIGN_CHANGE:.*]] = {{.*}}, i32 700, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
23 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_800_SIGN_CHANGE:.*]] = {{.*}}, i32 800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
25 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_900_SIGN_CHANGE:.*]] = {{.*}}, i32 900, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
26 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1000_SIGN_CHANGE:.*]] = {{.*}}, i32 1000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
27 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1200_SIGN_CHANGE:.*]] = {{.*}}, i32 1200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
28 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1300_SIGN_CHANGE:.*]] = {{.*}}, i32 1300, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
29 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1400_SIGN_CHANGE:.*]] = {{.*}}, i32 1400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
30 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1500_SIGN_CHANGE:.*]] = {{.*}}, i32 1500, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
31 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1600_SIGN_CHANGE:.*]] = {{.*}}, i32 1600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
33 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1700_SIGN_CHANGE:.*]] = {{.*}}, i32 1700, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
34 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1800_SIGN_CHANGE:.*]] = {{.*}}, i32 1800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
35 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2000_SIGN_CHANGE:.*]] = {{.*}}, i32 2000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
36 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2100_SIGN_CHANGE:.*]] = {{.*}}, i32 2100, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
37 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2200_SIGN_CHANGE:.*]] = {{.*}}, i32 2200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
38 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2300_SIGN_CHANGE:.*]] = {{.*}}, i32 2300, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
39 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2400_SIGN_CHANGE:.*]] = {{.*}}, i32 2400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
41 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2500_SIGN_CHANGE:.*]] = {{.*}}, i32 2500, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
42 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2600_SIGN_CHANGE:.*]] = {{.*}}, i32 2600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
43 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2800_SIGN_CHANGE:.*]] = {{.*}}, i32 2800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
44 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2900_SIGN_CHANGE:.*]] = {{.*}}, i32 2900, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
45 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3000_SIGN_CHANGE:.*]] = {{.*}}, i32 3000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
46 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3100_SIGN_CHANGE:.*]] = {{.*}}, i32 3100, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
47 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3200_SIGN_CHANGE:.*]] = {{.*}}, i32 3200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
49 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3300_SIGN_CHANGE:.*]] = {{.*}}, i32 3300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
50 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3400_SIGN_CHANGE:.*]] = {{.*}}, i32 3400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
51 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3600_SIGN_CHANGE:.*]] = {{.*}}, i32 3600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
52 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3700_SIGN_CHANGE:.*]] = {{.*}}, i32 3700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
53 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3800_SIGN_CHANGE:.*]] = {{.*}}, i32 3800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
54 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3900_SIGN_CHANGE:.*]] = {{.*}}, i32 3900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
55 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4000_SIGN_CHANGE:.*]] = {{.*}}, i32 4000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
57 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4100_SIGN_CHANGE:.*]] = {{.*}}, i32 4100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
58 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4200_SIGN_CHANGE:.*]] = {{.*}}, i32 4200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
59 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4300_SIGN_CHANGE:.*]] = {{.*}}, i32 4300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
60 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4400_SIGN_CHANGE:.*]] = {{.*}}, i32 4400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
61 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4500_SIGN_CHANGE:.*]] = {{.*}}, i32 4500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
62 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4600_SIGN_CHANGE:.*]] = {{.*}}, i32 4600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
63 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4700_SIGN_CHANGE:.*]] = {{.*}}, i32 4700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
64 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4800_SIGN_CHANGE:.*]] = {{.*}}, i32 4800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
66 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4900_SIGN_CHANGE:.*]] = {{.*}}, i32 4900, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
67 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5000_SIGN_CHANGE:.*]] = {{.*}}, i32 5000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
68 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5100_SIGN_CHANGE:.*]] = {{.*}}, i32 5100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
69 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5200_SIGN_CHANGE:.*]] = {{.*}}, i32 5200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
70 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5300_SIGN_CHANGE:.*]] = {{.*}}, i32 5300, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
71 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5400_SIGN_CHANGE:.*]] = {{.*}}, i32 5400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
72 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5500_SIGN_CHANGE:.*]] = {{.*}}, i32 5500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
73 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5600_SIGN_CHANGE:.*]] = {{.*}}, i32 5600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
75 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5700_SIGN_CHANGE:.*]] = {{.*}}, i32 5700, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
76 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5800_SIGN_CHANGE:.*]] = {{.*}}, i32 5800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
77 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6000_SIGN_CHANGE:.*]] = {{.*}}, i32 6000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
78 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6100_SIGN_CHANGE:.*]] = {{.*}}, i32 6100, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
79 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6200_SIGN_CHANGE:.*]] = {{.*}}, i32 6200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
80 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6300_SIGN_CHANGE:.*]] = {{.*}}, i32 6300, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
81 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6400_SIGN_CHANGE:.*]] = {{.*}}, i32 6400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
83 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6500_SIGN_CHANGE:.*]] = {{.*}}, i32 6500, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
84 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6600_SIGN_CHANGE:.*]] = {{.*}}, i32 6600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
85 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6800_SIGN_CHANGE:.*]] = {{.*}}, i32 6800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
86 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6900_SIGN_CHANGE:.*]] = {{.*}}, i32 6900, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
87 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7000_SIGN_CHANGE:.*]] = {{.*}}, i32 7000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
88 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7100_SIGN_CHANGE:.*]] = {{.*}}, i32 7100, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
89 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7200_SIGN_CHANGE:.*]] = {{.*}}, i32 7200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
91 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7300_SIGN_CHANGE:.*]] = {{.*}}, i32 7300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
92 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7400_SIGN_CHANGE:.*]] = {{.*}}, i32 7400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
93 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7600_SIGN_CHANGE:.*]] = {{.*}}, i32 7600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 3, i32 0 }
94 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7700_SIGN_CHANGE:.*]] = {{.*}}, i32 7700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
95 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7800_SIGN_CHANGE:.*]] = {{.*}}, i32 7800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
96 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7900_SIGN_CHANGE:.*]] = {{.*}}, i32 7900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 3, i32 0 }
97 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_8000_SIGN_CHANGE:.*]] = {{.*}}, i32 8000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 3, 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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
119 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
120 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
125 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_100_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
152 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
153 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
158 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_200_SIGN_CHANGE]], 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
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
) {
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
190 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
191 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
196 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_400_SIGN_CHANGE]], 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
207 // CHECK-LABEL: @signed_char_add_unsigned_char
208 void signed_char_add_unsigned_char(signed char *LHS
, unsigned char RHS
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
223 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
224 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
225 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
226 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
227 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
228 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
229 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
230 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
231 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
232 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
233 // CHECK-SANITIZE: [[CONT]]:
234 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
235 // CHECK-NEXT: ret void
241 // CHECK-LABEL: @signed_char_add_signed_char
242 void signed_char_add_signed_char(signed char *LHS
, signed char RHS
) {
244 // CHECK-NEXT: entry:
245 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
246 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
247 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
248 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
249 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
250 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
251 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
252 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
253 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
254 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHSEXT]]
255 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
256 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
257 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
258 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
259 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
260 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
261 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
262 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
263 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
264 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
265 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
266 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
267 // CHECK-SANITIZE: [[CONT]]:
268 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
269 // CHECK-NEXT: ret void
275 // CHECK-LABEL: @signed_char_add_signed_char_unsigned_int
276 void signed_char_add_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
278 // CHECK-NEXT: entry:
279 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
280 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
281 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
282 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
283 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
284 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
285 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
286 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
287 // CHECK-NEXT: %[[SRC:.*]] = add i32 %[[LHSEXT]], %[[RHS]]
288 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
289 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
290 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
291 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
292 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
293 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
294 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
295 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
296 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
297 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
298 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
299 // CHECK-SANITIZE: [[CONT]]:
300 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
301 // CHECK-NEXT: ret void
307 // CHECK-LABEL: @signed_char_add_signed_char_signed_int
308 void signed_char_add_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
310 // CHECK-NEXT: entry:
311 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
312 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
313 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
314 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
315 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
316 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
317 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
318 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
319 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHS]]
320 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
321 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
322 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
323 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
324 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
329 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_800_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
360 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
361 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
366 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_900_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
393 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
394 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
399 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1000_SIGN_CHANGE]], 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
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
) {
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
431 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
432 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
437 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1200_SIGN_CHANGE]], 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
448 // CHECK-LABEL: @signed_char_sub_unsigned_char
449 void signed_char_sub_unsigned_char(signed char *LHS
, unsigned char RHS
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
464 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
465 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
466 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
467 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
468 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
469 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
470 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
471 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
472 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
473 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
474 // CHECK-SANITIZE: [[CONT]]:
475 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
476 // CHECK-NEXT: ret void
482 // CHECK-LABEL: @signed_char_sub_signed_char
483 void signed_char_sub_signed_char(signed char *LHS
, signed char RHS
) {
485 // CHECK-NEXT: entry:
486 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
487 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
488 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
489 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
490 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
491 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
492 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
493 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
494 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
495 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
496 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
497 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
498 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
499 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
500 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
501 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
502 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
503 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
504 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
505 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
506 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
507 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
508 // CHECK-SANITIZE: [[CONT]]:
509 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
510 // CHECK-NEXT: ret void
516 // CHECK-LABEL: @signed_char_sub_signed_char_unsigned_int
517 void signed_char_sub_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
519 // CHECK-NEXT: entry:
520 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
521 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
522 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
523 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
524 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
525 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
526 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
527 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
528 // CHECK-NEXT: %[[SRC:.*]] = sub i32 %[[LHSEXT]], %[[RHS]]
529 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
530 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
531 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
532 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
533 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
534 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
535 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
536 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
537 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
538 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
539 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
540 // CHECK-SANITIZE: [[CONT]]:
541 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
542 // CHECK-NEXT: ret void
548 // CHECK-LABEL: @signed_char_sub_signed_char_signed_int
549 void signed_char_sub_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
551 // CHECK-NEXT: entry:
552 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
553 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
554 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
555 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
556 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
557 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
558 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
559 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
560 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHS]]
561 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
562 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
563 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
564 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
565 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
570 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1600_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
601 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
602 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
607 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1700_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
634 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
635 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
640 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1800_SIGN_CHANGE]], 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
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
) {
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
672 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
673 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
678 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2000_SIGN_CHANGE]], 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
689 // CHECK-LABEL: @signed_char_mul_unsigned_char
690 void signed_char_mul_unsigned_char(signed char *LHS
, unsigned char RHS
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
705 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
706 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
707 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
708 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
709 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
710 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
711 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
712 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
713 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
714 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
715 // CHECK-SANITIZE: [[CONT]]:
716 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
717 // CHECK-NEXT: ret void
723 // CHECK-LABEL: @signed_char_mul_signed_char
724 void signed_char_mul_signed_char(signed char *LHS
, signed char RHS
) {
726 // CHECK-NEXT: entry:
727 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
728 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
729 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
730 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
731 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
732 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
733 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
734 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
735 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
736 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
737 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
738 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
739 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
740 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
741 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
742 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
743 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
744 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
745 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
746 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
747 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
748 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
749 // CHECK-SANITIZE: [[CONT]]:
750 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
751 // CHECK-NEXT: ret void
757 // CHECK-LABEL: @signed_char_mul_signed_char_unsigned_int
758 void signed_char_mul_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
760 // CHECK-NEXT: entry:
761 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
762 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
763 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
764 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
765 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
766 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
767 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
768 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
769 // CHECK-NEXT: %[[SRC:.*]] = mul i32 %[[LHSEXT]], %[[RHS]]
770 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
771 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
772 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
773 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
774 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
775 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
776 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
777 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
778 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
779 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
780 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
781 // CHECK-SANITIZE: [[CONT]]:
782 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
783 // CHECK-NEXT: ret void
789 // CHECK-LABEL: @signed_char_mul_signed_char_signed_int
790 void signed_char_mul_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
792 // CHECK-NEXT: entry:
793 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
794 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
795 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
796 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
797 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
798 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
799 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
800 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
801 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHS]]
802 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
803 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
804 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
805 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
806 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
811 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2400_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
842 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
843 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
848 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2500_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
875 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
876 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
881 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2600_SIGN_CHANGE]], 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
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
) {
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
913 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
914 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
919 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2800_SIGN_CHANGE]], 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
930 // CHECK-LABEL: @signed_char_div_unsigned_char
931 void signed_char_div_unsigned_char(signed char *LHS
, unsigned char RHS
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
946 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
947 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
948 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
949 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
950 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
951 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
952 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
953 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
954 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
955 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
956 // CHECK-SANITIZE: [[CONT]]:
957 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
958 // CHECK-NEXT: ret void
964 // CHECK-LABEL: @signed_char_div_signed_char
965 void signed_char_div_signed_char(signed char *LHS
, signed char RHS
) {
967 // CHECK-NEXT: entry:
968 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
969 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
970 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
971 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
972 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
973 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
974 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
975 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
976 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
977 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
978 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
979 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
980 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
981 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
982 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
983 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
984 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
985 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
986 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
987 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
988 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
989 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
990 // CHECK-SANITIZE: [[CONT]]:
991 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
992 // CHECK-NEXT: ret void
998 // CHECK-LABEL: @signed_char_div_signed_char_unsigned_int
999 void signed_char_div_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1001 // CHECK-NEXT: entry:
1002 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1003 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1004 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1005 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1006 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1007 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1008 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1009 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1010 // CHECK-NEXT: %[[SRC:.*]] = udiv i32 %[[LHSEXT]], %[[RHS]]
1011 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1012 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1013 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
1014 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1015 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1016 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1017 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1018 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1019 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1020 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1021 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1022 // CHECK-SANITIZE: [[CONT]]:
1023 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1024 // CHECK-NEXT: ret void
1030 // CHECK-LABEL: @signed_char_div_signed_char_signed_int
1031 void signed_char_div_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1033 // CHECK-NEXT: entry:
1034 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1035 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1036 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1037 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1038 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1039 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1040 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1041 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1042 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHS]]
1043 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1044 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1045 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1046 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1047 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1052 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3200_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1083 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1084 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1089 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3300_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1116 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1117 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1122 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3400_SIGN_CHANGE]], 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
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
) {
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1154 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1155 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1160 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3600_SIGN_CHANGE]], 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
1171 // CHECK-LABEL: @signed_char_rem_unsigned_char
1172 void signed_char_rem_unsigned_char(signed char *LHS
, unsigned char RHS
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1187 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1188 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1189 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1190 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1191 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1192 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1193 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1194 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1195 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1196 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1197 // CHECK-SANITIZE: [[CONT]]:
1198 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1199 // CHECK-NEXT: ret void
1205 // CHECK-LABEL: @signed_char_rem_signed_char
1206 void signed_char_rem_signed_char(signed char *LHS
, signed char RHS
) {
1208 // CHECK-NEXT: entry:
1209 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1210 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1211 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1212 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1213 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1214 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1215 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1216 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1217 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1218 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1219 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1220 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1221 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1222 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1223 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1224 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1225 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1226 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1227 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1228 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1229 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1230 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1231 // CHECK-SANITIZE: [[CONT]]:
1232 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1233 // CHECK-NEXT: ret void
1239 // CHECK-LABEL: @signed_char_rem_signed_char_unsigned_int
1240 void signed_char_rem_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1242 // CHECK-NEXT: entry:
1243 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1244 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1245 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1246 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1247 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1248 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1249 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1250 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1251 // CHECK-NEXT: %[[SRC:.*]] = urem i32 %[[LHSEXT]], %[[RHS]]
1252 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1253 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1254 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
1255 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1256 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1257 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1258 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1259 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1260 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1261 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1262 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1263 // CHECK-SANITIZE: [[CONT]]:
1264 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1265 // CHECK-NEXT: ret void
1271 // CHECK-LABEL: @signed_char_rem_signed_char_signed_int
1272 void signed_char_rem_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1274 // CHECK-NEXT: entry:
1275 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1276 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1277 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1278 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1279 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1280 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1281 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1282 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1283 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHS]]
1284 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1285 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1286 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1287 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1288 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1293 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4000_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1324 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1325 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1330 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4100_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1357 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1358 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1363 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4200_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1389 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1390 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1395 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4300_SIGN_CHANGE]], 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
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
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1421 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1422 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], 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_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1427 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4400_SIGN_CHANGE]], 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
1438 // CHECK-LABEL: @signed_char_shl_unsigned_char
1439 void signed_char_shl_unsigned_char(signed char *LHS
, unsigned char RHS
) {
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: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1454 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1455 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1456 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1457 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1458 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1459 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1460 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1461 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1462 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1463 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1464 // CHECK-SANITIZE: [[CONT]]:
1465 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1466 // CHECK-NEXT: ret void
1472 // CHECK-LABEL: @signed_char_shl_signed_char
1473 void signed_char_shl_signed_char(signed char *LHS
, signed char RHS
) {
1475 // CHECK-NEXT: entry:
1476 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1477 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1478 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1479 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1480 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1481 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1482 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1483 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1484 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1485 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1486 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1487 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1488 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1489 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1490 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1491 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1492 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1493 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1494 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1495 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1496 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1497 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1498 // CHECK-SANITIZE: [[CONT]]:
1499 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1500 // CHECK-NEXT: ret void
1506 // CHECK-LABEL: @signed_char_shl_signed_char_unsigned_int
1507 void signed_char_shl_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1509 // CHECK-NEXT: entry:
1510 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1511 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1512 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1513 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1514 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1515 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1516 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1517 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1518 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1519 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1520 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1521 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1522 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1523 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1524 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1525 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1526 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1527 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1528 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1529 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1530 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1531 // CHECK-SANITIZE: [[CONT]]:
1532 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1533 // CHECK-NEXT: ret void
1539 // CHECK-LABEL: @signed_char_shl_signed_char_signed_int
1540 void signed_char_shl_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1542 // CHECK-NEXT: entry:
1543 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1544 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1545 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1546 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1547 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1548 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1549 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1550 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1551 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1552 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1553 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1554 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1555 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1556 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1557 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1558 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1559 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1560 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1561 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1562 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1563 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1564 // CHECK-SANITIZE: [[CONT]]:
1565 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1566 // CHECK-NEXT: ret void
1572 //----------------------------------------------------------------------------//
1573 // Compound right-shift operator. //
1574 //----------------------------------------------------------------------------//
1576 // CHECK-LABEL: @unsigned_char_shr_signed_char_unsigned_char
1577 void unsigned_char_shr_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
1579 // CHECK-NEXT: entry:
1580 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1581 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1582 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1583 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1584 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1585 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1586 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1587 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1588 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1589 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1590 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1591 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1592 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1593 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1594 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1595 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1596 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1597 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1598 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1599 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1600 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1601 // CHECK-SANITIZE: [[CONT]]:
1602 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1603 // CHECK-NEXT: ret void
1609 // CHECK-LABEL: @unsigned_char_shr_signed_char_signed_char
1610 void unsigned_char_shr_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
1612 // CHECK-NEXT: entry:
1613 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1614 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1615 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1616 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1617 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1618 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1619 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1620 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1621 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1622 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1623 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1624 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1625 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1626 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1627 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1628 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1629 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1630 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1631 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1632 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1633 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1634 // CHECK-SANITIZE: [[CONT]]:
1635 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1636 // CHECK-NEXT: ret void
1642 // CHECK-LABEL: @unsigned_char_shr_signed_char_unsigned_int
1643 void unsigned_char_shr_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
1645 // CHECK-NEXT: entry:
1646 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1647 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1648 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1649 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1650 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1651 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1652 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1653 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1654 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1655 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1656 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1657 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1658 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1659 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1660 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1661 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1662 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1663 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1664 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1665 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1666 // CHECK-SANITIZE: [[CONT]]:
1667 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1668 // CHECK-NEXT: ret void
1674 // CHECK-LABEL: @unsigned_char_shr_signed_char_signed_int
1675 void unsigned_char_shr_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
1677 // CHECK-NEXT: entry:
1678 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1679 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1680 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1681 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1682 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1683 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1684 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1685 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1686 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1687 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1688 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1689 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1690 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1691 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1692 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1693 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1694 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1695 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1696 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1697 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1698 // CHECK-SANITIZE: [[CONT]]:
1699 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1700 // CHECK-NEXT: ret void
1706 // CHECK-LABEL: @signed_char_shr_unsigned_char
1707 void signed_char_shr_unsigned_char(signed char *LHS
, unsigned char RHS
) {
1709 // CHECK-NEXT: entry:
1710 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1711 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1712 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1713 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1714 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1715 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1716 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1717 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1718 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1719 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1720 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1721 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1722 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1723 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1724 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1725 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1726 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1727 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1728 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1729 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1730 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1731 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1732 // CHECK-SANITIZE: [[CONT]]:
1733 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1734 // CHECK-NEXT: ret void
1740 // CHECK-LABEL: @signed_char_shr_signed_char
1741 void signed_char_shr_signed_char(signed char *LHS
, signed char RHS
) {
1743 // CHECK-NEXT: entry:
1744 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1745 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1746 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1747 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1748 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1749 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1750 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1751 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1752 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1753 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1754 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1755 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1756 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1757 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1758 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1759 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1760 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1761 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1762 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1763 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1764 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1765 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1766 // CHECK-SANITIZE: [[CONT]]:
1767 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1768 // CHECK-NEXT: ret void
1774 // CHECK-LABEL: @signed_char_shr_signed_char_unsigned_int
1775 void signed_char_shr_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1777 // CHECK-NEXT: entry:
1778 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1779 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1780 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1781 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1782 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1783 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1784 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1785 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1786 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1787 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1788 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1789 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1790 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1791 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1792 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1793 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1794 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1795 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1796 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1797 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1798 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1799 // CHECK-SANITIZE: [[CONT]]:
1800 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1801 // CHECK-NEXT: ret void
1807 // CHECK-LABEL: @signed_char_shr_signed_char_signed_int
1808 void signed_char_shr_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1810 // CHECK-NEXT: entry:
1811 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1812 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1813 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1814 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1815 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1816 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1817 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1818 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1819 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1820 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1821 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1822 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1823 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1824 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1825 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1826 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1827 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1828 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1829 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1830 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1831 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1832 // CHECK-SANITIZE: [[CONT]]:
1833 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1834 // CHECK-NEXT: ret void
1840 //----------------------------------------------------------------------------//
1841 // Compound and operator. //
1842 //----------------------------------------------------------------------------//
1844 // CHECK-LABEL: @unsigned_char_and_signed_char_unsigned_char
1845 void unsigned_char_and_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
1847 // CHECK-NEXT: entry:
1848 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1849 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1850 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1851 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1852 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1853 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1854 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1855 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1856 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1857 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1858 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1859 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1860 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1861 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1862 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1863 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1864 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1865 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1866 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1867 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1868 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1869 // CHECK-SANITIZE: [[CONT]]:
1870 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1871 // CHECK-NEXT: ret void
1877 // CHECK-LABEL: @unsigned_char_and_signed_char_signed_char
1878 void unsigned_char_and_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
1880 // CHECK-NEXT: entry:
1881 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1882 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1883 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1884 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1885 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1886 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1887 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1888 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1889 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1890 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1891 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1892 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1893 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1894 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1895 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1896 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1897 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1898 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1899 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1900 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1901 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1902 // CHECK-SANITIZE: [[CONT]]:
1903 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1904 // CHECK-NEXT: ret void
1910 // CHECK-LABEL: @unsigned_char_and_signed_char_unsigned_int
1911 void unsigned_char_and_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
1916 // CHECK-LABEL: @unsigned_char_and_signed_char_signed_int
1917 void unsigned_char_and_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
1919 // CHECK-NEXT: entry:
1920 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1921 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1922 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1923 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1924 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1925 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1926 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1927 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1928 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
1929 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1930 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1931 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
1932 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1933 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1934 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1935 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1936 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1937 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1938 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1939 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1940 // CHECK-SANITIZE: [[CONT]]:
1941 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1942 // CHECK-NEXT: ret void
1948 // CHECK-LABEL: @signed_char_and_unsigned_char
1949 void signed_char_and_unsigned_char(signed char *LHS
, unsigned char RHS
) {
1951 // CHECK-NEXT: entry:
1952 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1953 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1954 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1955 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1956 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1957 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1958 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1959 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1960 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1961 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1962 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1963 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1964 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1965 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
1966 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1967 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1968 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1969 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1970 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1971 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1972 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1973 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1974 // CHECK-SANITIZE: [[CONT]]:
1975 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1976 // CHECK-NEXT: ret void
1982 // CHECK-LABEL: @signed_char_and_signed_char
1983 void signed_char_and_signed_char(signed char *LHS
, signed char RHS
) {
1985 // CHECK-NEXT: entry:
1986 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1987 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1988 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1989 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1990 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1991 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1992 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1993 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1994 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1995 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1996 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1997 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
1998 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
1999 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2000 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2001 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2002 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2003 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2004 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2005 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2006 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2007 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2008 // CHECK-SANITIZE: [[CONT]]:
2009 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2010 // CHECK-NEXT: ret void
2016 // CHECK-LABEL: @signed_char_and_signed_char_unsigned_int
2017 void signed_char_and_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
2019 // CHECK-NEXT: entry:
2020 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2021 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2022 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2023 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2024 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2025 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2026 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2027 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2028 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2029 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2030 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2031 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
2032 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2033 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2034 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2035 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2036 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2037 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2038 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2039 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2040 // CHECK-SANITIZE: [[CONT]]:
2041 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2042 // CHECK-NEXT: ret void
2048 // CHECK-LABEL: @signed_char_and_signed_char_signed_int
2049 void signed_char_and_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
2051 // CHECK-NEXT: entry:
2052 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2053 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2054 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2055 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2056 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2057 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2058 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2059 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2060 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2061 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2062 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2063 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2064 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2065 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2066 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2067 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2068 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2069 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2070 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2071 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2072 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2073 // CHECK-SANITIZE: [[CONT]]:
2074 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2075 // CHECK-NEXT: ret void
2081 //----------------------------------------------------------------------------//
2082 // Compound xor operator. //
2083 //----------------------------------------------------------------------------//
2085 // CHECK-LABEL: @unsigned_char_or_signed_char_unsigned_char
2086 void unsigned_char_or_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
2088 // CHECK-NEXT: entry:
2089 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2090 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2091 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2092 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2093 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2094 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2095 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2096 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2097 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2098 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2099 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2100 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2101 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
2102 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2103 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2104 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2105 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2106 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2107 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6500_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2108 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2109 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2110 // CHECK-SANITIZE: [[CONT]]:
2111 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2112 // CHECK-NEXT: ret void
2118 // CHECK-LABEL: @unsigned_char_or_signed_char_signed_char
2119 void unsigned_char_or_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
2121 // CHECK-NEXT: entry:
2122 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2123 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2124 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2125 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2126 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2127 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2128 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2129 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2130 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2131 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2132 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2133 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2134 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
2135 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2136 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2137 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2138 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2139 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2140 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2141 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2142 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2143 // CHECK-SANITIZE: [[CONT]]:
2144 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2145 // CHECK-NEXT: ret void
2151 // CHECK-LABEL: @unsigned_char_or_signed_char_unsigned_int
2152 void unsigned_char_or_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
2157 // CHECK-LABEL: @unsigned_char_or_signed_char_signed_int
2158 void unsigned_char_or_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
2160 // CHECK-NEXT: entry:
2161 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2162 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2163 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2164 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2165 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2166 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2167 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2168 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2169 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2170 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2171 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2172 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
2173 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2174 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2175 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2176 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2177 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2178 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2179 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2180 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2181 // CHECK-SANITIZE: [[CONT]]:
2182 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2183 // CHECK-NEXT: ret void
2189 // CHECK-LABEL: @signed_char_or_unsigned_char
2190 void signed_char_or_unsigned_char(signed char *LHS
, unsigned char RHS
) {
2192 // CHECK-NEXT: entry:
2193 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2194 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2195 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2196 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2197 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2198 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2199 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2200 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2201 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2202 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2203 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2204 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2205 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2206 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2207 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2208 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2209 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2210 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2211 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2212 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2213 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2214 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2215 // CHECK-SANITIZE: [[CONT]]:
2216 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2217 // CHECK-NEXT: ret void
2223 // CHECK-LABEL: @signed_char_or_signed_char
2224 void signed_char_or_signed_char(signed char *LHS
, signed char RHS
) {
2226 // CHECK-NEXT: entry:
2227 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2228 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2229 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2230 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2231 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2232 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2233 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2234 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2235 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2236 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2237 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2238 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2239 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2240 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2241 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2242 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2243 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2244 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2245 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2246 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2247 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2248 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2249 // CHECK-SANITIZE: [[CONT]]:
2250 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2251 // CHECK-NEXT: ret void
2257 // CHECK-LABEL: @signed_char_or_signed_char_unsigned_int
2258 void signed_char_or_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
2260 // CHECK-NEXT: entry:
2261 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2262 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2263 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2264 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2265 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2266 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2267 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2268 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2269 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2270 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2271 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2272 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
2273 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2274 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2275 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2276 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2277 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2278 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7100_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2279 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2280 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2281 // CHECK-SANITIZE: [[CONT]]:
2282 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2283 // CHECK-NEXT: ret void
2289 // CHECK-LABEL: @signed_char_or_signed_char_signed_int
2290 void signed_char_or_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
2292 // CHECK-NEXT: entry:
2293 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2294 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2295 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2296 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2297 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2298 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2299 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2300 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2301 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2302 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2303 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2304 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2305 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2306 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2307 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2308 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2309 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2310 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2311 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7200_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2312 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2313 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2314 // CHECK-SANITIZE: [[CONT]]:
2315 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2316 // CHECK-NEXT: ret void
2322 //----------------------------------------------------------------------------//
2323 // Compound or operator. //
2324 //----------------------------------------------------------------------------//
2326 // CHECK-LABEL: @unsigned_char_xor_signed_char_unsigned_char
2327 void unsigned_char_xor_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
2329 // CHECK-NEXT: entry:
2330 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2331 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2332 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2333 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2334 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2335 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2336 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2337 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2338 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2339 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2340 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2341 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2342 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
2343 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2344 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2345 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2346 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2347 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2348 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7300_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2349 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2350 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2351 // CHECK-SANITIZE: [[CONT]]:
2352 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2353 // CHECK-NEXT: ret void
2359 // CHECK-LABEL: @unsigned_char_xor_signed_char_signed_char
2360 void unsigned_char_xor_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
2362 // CHECK-NEXT: entry:
2363 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2364 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2365 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2366 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2367 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2368 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2369 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2370 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2371 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2372 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2373 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2374 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2375 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
2376 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2377 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2378 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2379 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2380 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2381 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7400_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2382 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2383 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2384 // CHECK-SANITIZE: [[CONT]]:
2385 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2386 // CHECK-NEXT: ret void
2392 // CHECK-LABEL: @unsigned_char_xor_signed_char_unsigned_int
2393 void unsigned_char_xor_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
2398 // CHECK-LABEL: @unsigned_char_xor_signed_char_signed_int
2399 void unsigned_char_xor_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
2401 // CHECK-NEXT: entry:
2402 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2403 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2404 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2405 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2406 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2407 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2408 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2409 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2410 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2411 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2412 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2413 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], false, !nosanitize
2414 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2415 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2416 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2417 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2418 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2419 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7600_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2420 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2421 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2422 // CHECK-SANITIZE: [[CONT]]:
2423 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2424 // CHECK-NEXT: ret void
2430 // CHECK-LABEL: @signed_char_xor_unsigned_char
2431 void signed_char_xor_unsigned_char(signed char *LHS
, unsigned char RHS
) {
2433 // CHECK-NEXT: entry:
2434 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2435 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2436 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2437 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2438 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2439 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2440 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2441 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2442 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2443 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2444 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2445 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2446 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2447 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2448 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2449 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2450 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2451 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2452 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2453 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7700_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2454 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2455 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2456 // CHECK-SANITIZE: [[CONT]]:
2457 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2458 // CHECK-NEXT: ret void
2464 // CHECK-LABEL: @signed_char_xor_signed_char
2465 void signed_char_xor_signed_char(signed char *LHS
, signed char RHS
) {
2467 // CHECK-NEXT: entry:
2468 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2469 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2470 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2471 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2472 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2473 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2474 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2475 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2476 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2477 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2478 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2479 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2480 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2481 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2482 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2483 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2484 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2485 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2486 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2487 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7800_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2488 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2489 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2490 // CHECK-SANITIZE: [[CONT]]:
2491 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2492 // CHECK-NEXT: ret void
2498 // CHECK-LABEL: @signed_char_xor_signed_char_unsigned_int
2499 void signed_char_xor_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
2501 // CHECK-NEXT: entry:
2502 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2503 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2504 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2505 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2506 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2507 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2508 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2509 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2510 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2511 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2512 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2513 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 false, %[[DST_NEGATIVITYCHECK]], !nosanitize
2514 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2515 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2516 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2517 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2518 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2519 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7900_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2520 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2521 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2522 // CHECK-SANITIZE: [[CONT]]:
2523 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2524 // CHECK-NEXT: ret void
2530 // CHECK-LABEL: @signed_char_xor_signed_char_signed_int
2531 void signed_char_xor_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
2533 // CHECK-NEXT: entry:
2534 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2535 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2536 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2537 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2538 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2539 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2540 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2541 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2542 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2543 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2544 // CHECK-SANITIZE-NEXT: %[[SRC_NEGATIVITYCHECK:.*]] = icmp slt i32 %[[SRC]], 0, !nosanitize
2545 // CHECK-SANITIZE-NEXT: %[[DST_NEGATIVITYCHECK:.*]] = icmp slt i8 %[[DST]], 0, !nosanitize
2546 // CHECK-SANITIZE-NEXT: %[[SIGNCHANGECHECK:.*]] = icmp eq i1 %[[SRC_NEGATIVITYCHECK]], %[[DST_NEGATIVITYCHECK]], !nosanitize
2547 // CHECK-SANITIZE-NEXT: br i1 %[[SIGNCHANGECHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2548 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2549 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2550 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2551 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_8000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2552 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_8000_SIGN_CHANGE]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2553 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2554 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2555 // CHECK-SANITIZE: [[CONT]]:
2556 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2557 // CHECK-NEXT: ret void