1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK
3 // RUN: %clang_cc1 -fsanitize=implicit-unsigned-integer-truncation,implicit-signed-integer-truncation -fno-sanitize-recover=implicit-unsigned-integer-truncation,implicit-signed-integer-truncation -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-unsigned-integer-truncation,implicit-signed-integer-truncation -fsanitize-recover=implicit-unsigned-integer-truncation,implicit-signed-integer-truncation -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-unsigned-integer-truncation,implicit-signed-integer-truncation -fsanitize-trap=implicit-unsigned-integer-truncation,implicit-signed-integer-truncation -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
7 // LHS can be of 2 types: unsigned char and signed char
8 // RHS can be of 4 types: unsigned char, signed char, unsigned int, signed int.
9 // Therefore there are total of 8 tests per group.
11 // Also there are total of 10 compound operators (+=, -=, *=, /=, %=, <<=, >>=, &=, ^=, |=)
13 // CHECK-SANITIZE-ANYRECOVER: @[[INT:.*]] = {{.*}} c"'int'\00" }
14 // CHECK-SANITIZE-ANYRECOVER: @[[UNSIGNED_CHAR:.*]] = {{.*}} c"'unsigned char'\00" }
15 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
16 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
17 // CHECK-SANITIZE-ANYRECOVER: @[[UNSIGNED_INT:.*]] = {{.*}} c"'unsigned int'\00" }
18 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_300_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 300, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
19 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
20 // CHECK-SANITIZE-ANYRECOVER: @[[SIGNED_CHAR:.*]] = {{.*}} c"'signed char'\00" }
21 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
22 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
23 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 700, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
24 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
26 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 900, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
27 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
28 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1100_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 1100, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
29 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
30 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1300, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
31 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
32 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1500, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
33 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
35 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1700, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
36 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 1800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
37 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_1900_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 1900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
38 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
39 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2100, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
40 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
41 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2300, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
42 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
44 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2500, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
45 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
46 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2700_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 2700, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
47 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
48 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_2900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 2900, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
49 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
50 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3100, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
51 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
53 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
54 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
55 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3500_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 3500, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
56 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
57 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
58 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
59 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_3900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 3900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
60 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
62 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
63 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
64 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
65 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
66 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
67 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
68 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
69 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
71 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_4900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 4900, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
72 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
73 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5100, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
74 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5200, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
75 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5300, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
76 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
77 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5500, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
78 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5600, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
80 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5700, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
81 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 5800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
82 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_5900_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 5900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
83 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6000, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
84 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6100, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
85 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
86 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6300, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
87 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6400, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
89 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6500_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6500, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
90 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
91 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6700_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 6700, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
92 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6800, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
93 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_6900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 6900, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
94 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
95 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7100_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7100, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
96 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7200_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7200, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
98 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7300_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7300, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
99 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7400_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7400, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
100 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7500_UNSIGNED_TRUNCATION:.*]] = {{.*}}, i32 7500, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[UNSIGNED_CHAR]], i8 1, i32 0 }
101 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7600_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7600, i32 10 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
102 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7700_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7700, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
103 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7800_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7800, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
104 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_7900_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 7900, i32 10 }, ptr @[[UNSIGNED_INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
105 // CHECK-SANITIZE-ANYRECOVER: @[[LINE_8000_SIGNED_TRUNCATION:.*]] = {{.*}}, i32 8000, i32 10 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
107 //----------------------------------------------------------------------------//
108 // Compound add operator. //
109 //----------------------------------------------------------------------------//
111 // CHECK-LABEL: @unsigned_char_add_signed_char_unsigned_char
112 void unsigned_char_add_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
114 // CHECK-NEXT: entry:
115 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
116 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
117 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
118 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
119 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
120 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
121 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
122 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
123 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
124 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHSEXT]]
125 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
126 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
127 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
128 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
129 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
130 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
131 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
132 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
133 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
134 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
135 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
136 // CHECK-SANITIZE: [[CONT]]:
137 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
138 // CHECK-NEXT: ret void
144 // CHECK-LABEL: @unsigned_char_add_signed_char_signed_char
145 void unsigned_char_add_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
147 // CHECK-NEXT: entry:
148 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
149 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
150 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
151 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
152 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
153 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
154 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
155 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
156 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
157 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHSEXT]]
158 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
159 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
160 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
161 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
162 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
163 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
164 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
165 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
166 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
167 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
168 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
169 // CHECK-SANITIZE: [[CONT]]:
170 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
171 // CHECK-NEXT: ret void
177 // CHECK-LABEL: @unsigned_char_add_signed_char_unsigned_int
178 void unsigned_char_add_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
180 // CHECK-NEXT: entry:
181 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
182 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
183 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
184 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
185 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
186 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
187 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
188 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
189 // CHECK-NEXT: %[[SRC:.*]] = add i32 %[[LHSEXT]], %[[RHS]]
190 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
191 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
192 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
193 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
194 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
195 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
196 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
197 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_300_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
198 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_300_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
199 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
200 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
201 // CHECK-SANITIZE: [[CONT]]:
202 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
203 // CHECK-NEXT: ret void
209 // CHECK-LABEL: @unsigned_char_add_signed_char_signed_int
210 void unsigned_char_add_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
212 // CHECK-NEXT: entry:
213 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
214 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
215 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
216 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
217 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
218 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
219 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
220 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
221 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHS]]
222 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
223 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
224 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
225 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], 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_400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
230 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_400_SIGNED_TRUNCATION]], 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_unsigned_char
242 void signed_char_add_unsigned_char(signed char *LHS
, unsigned 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:.*]] = zext 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: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
257 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
258 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
259 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
260 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
261 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
262 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
263 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
264 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
265 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
266 // CHECK-SANITIZE: [[CONT]]:
267 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
268 // CHECK-NEXT: ret void
274 // CHECK-LABEL: @signed_char_add_signed_char
275 void signed_char_add_signed_char(signed char *LHS
, signed char RHS
) {
277 // CHECK-NEXT: entry:
278 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
279 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
280 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
281 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
282 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
283 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
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 nsw i32 %[[LHSEXT]], %[[RHSEXT]]
288 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
289 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
290 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
291 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], 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_600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
296 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_600_SIGNED_TRUNCATION]], 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_unsigned_int
308 void signed_char_add_signed_char_unsigned_int(signed char *LHS
, unsigned 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 i32 %[[LHSEXT]], %[[RHS]]
320 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
321 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
322 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
323 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
324 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
325 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
326 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
327 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
328 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
329 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
330 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
331 // CHECK-SANITIZE: [[CONT]]:
332 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
333 // CHECK-NEXT: ret void
339 // CHECK-LABEL: @signed_char_add_signed_char_signed_int
340 void signed_char_add_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
342 // CHECK-NEXT: entry:
343 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
344 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
345 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
346 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
347 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
348 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
349 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
350 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
351 // CHECK-NEXT: %[[SRC:.*]] = add nsw i32 %[[LHSEXT]], %[[RHS]]
352 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
353 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
354 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
355 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
356 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
357 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
358 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
359 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
360 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
361 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
362 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
363 // CHECK-SANITIZE: [[CONT]]:
364 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
365 // CHECK-NEXT: ret void
371 //----------------------------------------------------------------------------//
372 // Compound subtract operator. //
373 //----------------------------------------------------------------------------//
375 // CHECK-LABEL: @unsigned_char_sub_signed_char_unsigned_char
376 void unsigned_char_sub_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
378 // CHECK-NEXT: entry:
379 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
380 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
381 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
382 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
383 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
384 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
385 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
386 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
387 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
388 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
389 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
390 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
391 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
392 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
393 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
394 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
395 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
396 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
397 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
398 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
399 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
400 // CHECK-SANITIZE: [[CONT]]:
401 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
402 // CHECK-NEXT: ret void
408 // CHECK-LABEL: @unsigned_char_sub_signed_char_signed_char
409 void unsigned_char_sub_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
411 // CHECK-NEXT: entry:
412 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
413 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
414 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
415 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
416 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
417 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
418 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
419 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
420 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
421 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
422 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
423 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
424 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
425 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
426 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
427 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
428 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
429 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
430 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
431 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
432 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
433 // CHECK-SANITIZE: [[CONT]]:
434 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
435 // CHECK-NEXT: ret void
441 // CHECK-LABEL: @unsigned_char_sub_signed_char_unsigned_int
442 void unsigned_char_sub_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
444 // CHECK-NEXT: entry:
445 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
446 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
447 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
448 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
449 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
450 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
451 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
452 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
453 // CHECK-NEXT: %[[SRC:.*]] = sub i32 %[[LHSEXT]], %[[RHS]]
454 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
455 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
456 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
457 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
458 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
459 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
460 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
461 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1100_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
462 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1100_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
463 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
464 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
465 // CHECK-SANITIZE: [[CONT]]:
466 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
467 // CHECK-NEXT: ret void
473 // CHECK-LABEL: @unsigned_char_sub_signed_char_signed_int
474 void unsigned_char_sub_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
476 // CHECK-NEXT: entry:
477 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
478 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
479 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
480 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
481 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
482 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
483 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
484 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
485 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHS]]
486 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
487 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
488 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
489 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
490 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
491 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
492 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
493 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
494 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
495 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
496 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
497 // CHECK-SANITIZE: [[CONT]]:
498 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
499 // CHECK-NEXT: ret void
505 // CHECK-LABEL: @signed_char_sub_unsigned_char
506 void signed_char_sub_unsigned_char(signed char *LHS
, unsigned char RHS
) {
508 // CHECK-NEXT: entry:
509 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
510 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
511 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
512 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
513 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
514 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
515 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
516 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
517 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
518 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
519 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
520 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
521 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
522 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
523 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
524 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
525 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
526 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
527 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
528 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
529 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
530 // CHECK-SANITIZE: [[CONT]]:
531 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
532 // CHECK-NEXT: ret void
538 // CHECK-LABEL: @signed_char_sub_signed_char
539 void signed_char_sub_signed_char(signed char *LHS
, signed char RHS
) {
541 // CHECK-NEXT: entry:
542 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
543 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
544 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
545 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
546 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
547 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
548 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
549 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
550 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
551 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHSEXT]]
552 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
553 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
554 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
555 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
556 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
557 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
558 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
559 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
560 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
561 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
562 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
563 // CHECK-SANITIZE: [[CONT]]:
564 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
565 // CHECK-NEXT: ret void
571 // CHECK-LABEL: @signed_char_sub_signed_char_unsigned_int
572 void signed_char_sub_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
574 // CHECK-NEXT: entry:
575 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
576 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
577 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
578 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
579 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
580 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
581 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
582 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
583 // CHECK-NEXT: %[[SRC:.*]] = sub i32 %[[LHSEXT]], %[[RHS]]
584 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
585 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
586 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
587 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
588 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
589 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
590 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
591 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
592 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
593 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
594 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
595 // CHECK-SANITIZE: [[CONT]]:
596 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
597 // CHECK-NEXT: ret void
603 // CHECK-LABEL: @signed_char_sub_signed_char_signed_int
604 void signed_char_sub_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
606 // CHECK-NEXT: entry:
607 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
608 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
609 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
610 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
611 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
612 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
613 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
614 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
615 // CHECK-NEXT: %[[SRC:.*]] = sub nsw i32 %[[LHSEXT]], %[[RHS]]
616 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
617 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
618 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
619 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
620 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
621 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
622 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
623 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
624 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
625 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
626 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
627 // CHECK-SANITIZE: [[CONT]]:
628 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
629 // CHECK-NEXT: ret void
635 //----------------------------------------------------------------------------//
636 // Compound multiply operator. //
637 //----------------------------------------------------------------------------//
639 // CHECK-LABEL: @unsigned_char_mul_signed_char_unsigned_char
640 void unsigned_char_mul_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
642 // CHECK-NEXT: entry:
643 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
644 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
645 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
646 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
647 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
648 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
649 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
650 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
651 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
652 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
653 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
654 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
655 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
656 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
657 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
658 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
659 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
660 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
661 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
662 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
663 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
664 // CHECK-SANITIZE: [[CONT]]:
665 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
666 // CHECK-NEXT: ret void
672 // CHECK-LABEL: @unsigned_char_mul_signed_char_signed_char
673 void unsigned_char_mul_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
675 // CHECK-NEXT: entry:
676 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
677 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
678 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
679 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
680 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
681 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
682 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
683 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
684 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
685 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
686 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
687 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
688 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
689 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
690 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
691 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
692 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
693 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
694 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
695 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
696 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
697 // CHECK-SANITIZE: [[CONT]]:
698 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
699 // CHECK-NEXT: ret void
705 // CHECK-LABEL: @unsigned_char_mul_signed_char_unsigned_int
706 void unsigned_char_mul_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
708 // CHECK-NEXT: entry:
709 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
710 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
711 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
712 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
713 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
714 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
715 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
716 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
717 // CHECK-NEXT: %[[SRC:.*]] = mul i32 %[[LHSEXT]], %[[RHS]]
718 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
719 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
720 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
721 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
722 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
723 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
724 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
725 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_1900_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
726 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1900_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
727 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
728 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
729 // CHECK-SANITIZE: [[CONT]]:
730 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
731 // CHECK-NEXT: ret void
737 // CHECK-LABEL: @unsigned_char_mul_signed_char_signed_int
738 void unsigned_char_mul_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
740 // CHECK-NEXT: entry:
741 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
742 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
743 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
744 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
745 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
746 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
747 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
748 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
749 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHS]]
750 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
751 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
752 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
753 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
754 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
755 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
756 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
757 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
758 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
759 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
760 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
761 // CHECK-SANITIZE: [[CONT]]:
762 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
763 // CHECK-NEXT: ret void
769 // CHECK-LABEL: @signed_char_mul_unsigned_char
770 void signed_char_mul_unsigned_char(signed char *LHS
, unsigned char RHS
) {
772 // CHECK-NEXT: entry:
773 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
774 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
775 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
776 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
777 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
778 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
779 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
780 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
781 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
782 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
783 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
784 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
785 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
786 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
787 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
788 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
789 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
790 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
791 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
792 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
793 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
794 // CHECK-SANITIZE: [[CONT]]:
795 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
796 // CHECK-NEXT: ret void
802 // CHECK-LABEL: @signed_char_mul_signed_char
803 void signed_char_mul_signed_char(signed char *LHS
, signed char RHS
) {
805 // CHECK-NEXT: entry:
806 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
807 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
808 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
809 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
810 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
811 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
812 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
813 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
814 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
815 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHSEXT]]
816 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
817 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
818 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
819 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
820 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
821 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
822 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
823 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
824 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
825 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
826 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
827 // CHECK-SANITIZE: [[CONT]]:
828 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
829 // CHECK-NEXT: ret void
835 // CHECK-LABEL: @signed_char_mul_signed_char_unsigned_int
836 void signed_char_mul_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
838 // CHECK-NEXT: entry:
839 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
840 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
841 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
842 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
843 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
844 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
845 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
846 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
847 // CHECK-NEXT: %[[SRC:.*]] = mul i32 %[[LHSEXT]], %[[RHS]]
848 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
849 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
850 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
851 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
852 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
853 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
854 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
855 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
856 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
857 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
858 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
859 // CHECK-SANITIZE: [[CONT]]:
860 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
861 // CHECK-NEXT: ret void
867 // CHECK-LABEL: @signed_char_mul_signed_char_signed_int
868 void signed_char_mul_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
870 // CHECK-NEXT: entry:
871 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
872 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
873 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
874 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
875 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
876 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
877 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
878 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
879 // CHECK-NEXT: %[[SRC:.*]] = mul nsw i32 %[[LHSEXT]], %[[RHS]]
880 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
881 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
882 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
883 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
884 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
885 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
886 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
887 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
888 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
889 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
890 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
891 // CHECK-SANITIZE: [[CONT]]:
892 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
893 // CHECK-NEXT: ret void
899 //----------------------------------------------------------------------------//
900 // Compound divide operator. //
901 //----------------------------------------------------------------------------//
903 // CHECK-LABEL: @unsigned_char_div_signed_char_unsigned_char
904 void unsigned_char_div_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
906 // CHECK-NEXT: entry:
907 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
908 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
909 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
910 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
911 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
912 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
913 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
914 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
915 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
916 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
917 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
918 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
919 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
920 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
921 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
922 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
923 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
924 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
925 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
926 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
927 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
928 // CHECK-SANITIZE: [[CONT]]:
929 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
930 // CHECK-NEXT: ret void
936 // CHECK-LABEL: @unsigned_char_div_signed_char_signed_char
937 void unsigned_char_div_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
939 // CHECK-NEXT: entry:
940 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
941 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
942 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
943 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
944 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
945 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
946 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
947 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
948 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
949 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
950 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
951 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
952 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
953 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
954 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
955 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
956 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
957 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
958 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
959 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
960 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
961 // CHECK-SANITIZE: [[CONT]]:
962 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
963 // CHECK-NEXT: ret void
969 // CHECK-LABEL: @unsigned_char_div_signed_char_unsigned_int
970 void unsigned_char_div_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
972 // CHECK-NEXT: entry:
973 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
974 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
975 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
976 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
977 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
978 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
979 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
980 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
981 // CHECK-NEXT: %[[SRC:.*]] = udiv i32 %[[LHSEXT]], %[[RHS]]
982 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
983 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
984 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
985 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
986 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
987 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
988 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
989 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2700_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
990 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2700_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
991 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
992 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
993 // CHECK-SANITIZE: [[CONT]]:
994 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
995 // CHECK-NEXT: ret void
1001 // CHECK-LABEL: @unsigned_char_div_signed_char_signed_int
1002 void unsigned_char_div_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
1004 // CHECK-NEXT: entry:
1005 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1006 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1007 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1008 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1009 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1010 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1011 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1012 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1013 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHS]]
1014 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1015 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1016 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1017 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1018 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1019 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1020 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1021 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1022 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1023 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1024 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1025 // CHECK-SANITIZE: [[CONT]]:
1026 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1027 // CHECK-NEXT: ret void
1033 // CHECK-LABEL: @signed_char_div_unsigned_char
1034 void signed_char_div_unsigned_char(signed char *LHS
, unsigned char RHS
) {
1036 // CHECK-NEXT: entry:
1037 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1038 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1039 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1040 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1041 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1042 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1043 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1044 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1045 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1046 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
1047 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1048 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1049 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1050 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1051 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1052 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1053 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1054 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_2900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1055 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_2900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1056 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1057 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1058 // CHECK-SANITIZE: [[CONT]]:
1059 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1060 // CHECK-NEXT: ret void
1066 // CHECK-LABEL: @signed_char_div_signed_char
1067 void signed_char_div_signed_char(signed char *LHS
, signed char RHS
) {
1069 // CHECK-NEXT: entry:
1070 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1071 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1072 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1073 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1074 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1075 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1076 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1077 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1078 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1079 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHSEXT]]
1080 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1081 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1082 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1083 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1084 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1085 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1086 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1087 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1088 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1089 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1090 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1091 // CHECK-SANITIZE: [[CONT]]:
1092 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1093 // CHECK-NEXT: ret void
1099 // CHECK-LABEL: @signed_char_div_signed_char_unsigned_int
1100 void signed_char_div_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1102 // CHECK-NEXT: entry:
1103 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1104 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1105 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1106 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1107 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1108 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1109 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1110 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1111 // CHECK-NEXT: %[[SRC:.*]] = udiv i32 %[[LHSEXT]], %[[RHS]]
1112 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1113 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1114 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1115 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1116 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1117 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1118 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1119 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1120 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1121 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1122 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1123 // CHECK-SANITIZE: [[CONT]]:
1124 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1125 // CHECK-NEXT: ret void
1131 // CHECK-LABEL: @signed_char_div_signed_char_signed_int
1132 void signed_char_div_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1134 // CHECK-NEXT: entry:
1135 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1136 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1137 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1138 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1139 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1140 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1141 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1142 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1143 // CHECK-NEXT: %[[SRC:.*]] = sdiv i32 %[[LHSEXT]], %[[RHS]]
1144 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1145 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1146 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1147 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1148 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1149 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1150 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1151 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1152 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1153 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1154 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1155 // CHECK-SANITIZE: [[CONT]]:
1156 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1157 // CHECK-NEXT: ret void
1163 //----------------------------------------------------------------------------//
1164 // Compound remainder operator. //
1165 //----------------------------------------------------------------------------//
1167 // CHECK-LABEL: @unsigned_char_rem_signed_char_unsigned_char
1168 void unsigned_char_rem_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
1170 // CHECK-NEXT: entry:
1171 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1172 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1173 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1174 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1175 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1176 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1177 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1178 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1179 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1180 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1181 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1182 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1183 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1184 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1185 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1186 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1187 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1188 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1189 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1190 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1191 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1192 // CHECK-SANITIZE: [[CONT]]:
1193 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1194 // CHECK-NEXT: ret void
1200 // CHECK-LABEL: @unsigned_char_rem_signed_char_signed_char
1201 void unsigned_char_rem_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
1203 // CHECK-NEXT: entry:
1204 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1205 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1206 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1207 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1208 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1209 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1210 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1211 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1212 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1213 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1214 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1215 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1216 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1217 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1218 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1219 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1220 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1221 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1222 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1223 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1224 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1225 // CHECK-SANITIZE: [[CONT]]:
1226 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1227 // CHECK-NEXT: ret void
1233 // CHECK-LABEL: @unsigned_char_rem_signed_char_unsigned_int
1234 void unsigned_char_rem_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
1236 // CHECK-NEXT: entry:
1237 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1238 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1239 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1240 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1241 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1242 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1243 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1244 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1245 // CHECK-NEXT: %[[SRC:.*]] = urem i32 %[[LHSEXT]], %[[RHS]]
1246 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1247 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1248 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1249 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1250 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1251 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1252 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1253 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3500_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1254 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3500_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1255 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1256 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1257 // CHECK-SANITIZE: [[CONT]]:
1258 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1259 // CHECK-NEXT: ret void
1265 // CHECK-LABEL: @unsigned_char_rem_signed_char_signed_int
1266 void unsigned_char_rem_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
1268 // CHECK-NEXT: entry:
1269 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1270 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1271 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1272 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1273 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1274 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1275 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1276 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1277 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHS]]
1278 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1279 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1280 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1281 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1282 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1283 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1284 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1285 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1286 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1287 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1288 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1289 // CHECK-SANITIZE: [[CONT]]:
1290 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1291 // CHECK-NEXT: ret void
1297 // CHECK-LABEL: @signed_char_rem_unsigned_char
1298 void signed_char_rem_unsigned_char(signed char *LHS
, unsigned char RHS
) {
1300 // CHECK-NEXT: entry:
1301 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1302 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1303 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1304 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1305 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1306 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1307 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1308 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1309 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1310 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1311 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1312 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1313 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1314 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1315 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1316 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1317 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1318 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1319 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1320 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1321 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1322 // CHECK-SANITIZE: [[CONT]]:
1323 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1324 // CHECK-NEXT: ret void
1330 // CHECK-LABEL: @signed_char_rem_signed_char
1331 void signed_char_rem_signed_char(signed char *LHS
, signed char RHS
) {
1333 // CHECK-NEXT: entry:
1334 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1335 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1336 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1337 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1338 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1339 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1340 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1341 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1342 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1343 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHSEXT]]
1344 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1345 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1346 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1347 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1348 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1349 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1350 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1351 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1352 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1353 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1354 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1355 // CHECK-SANITIZE: [[CONT]]:
1356 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1357 // CHECK-NEXT: ret void
1363 // CHECK-LABEL: @signed_char_rem_signed_char_unsigned_int
1364 void signed_char_rem_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1366 // CHECK-NEXT: entry:
1367 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1368 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1369 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1370 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1371 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1372 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1373 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1374 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1375 // CHECK-NEXT: %[[SRC:.*]] = urem i32 %[[LHSEXT]], %[[RHS]]
1376 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1377 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1378 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1379 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1380 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1381 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1382 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1383 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_3900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1384 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_3900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1385 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1386 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1387 // CHECK-SANITIZE: [[CONT]]:
1388 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1389 // CHECK-NEXT: ret void
1395 // CHECK-LABEL: @signed_char_rem_signed_char_signed_int
1396 void signed_char_rem_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1398 // CHECK-NEXT: entry:
1399 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1400 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1401 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1402 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1403 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1404 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1405 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1406 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1407 // CHECK-NEXT: %[[SRC:.*]] = srem i32 %[[LHSEXT]], %[[RHS]]
1408 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1409 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1410 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1411 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1412 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1413 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1414 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1415 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1416 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1417 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1418 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1419 // CHECK-SANITIZE: [[CONT]]:
1420 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1421 // CHECK-NEXT: ret void
1427 //----------------------------------------------------------------------------//
1428 // Compound left-shift operator. //
1429 //----------------------------------------------------------------------------//
1431 // CHECK-LABEL: @unsigned_char_shl_signed_char_unsigned_char
1432 void unsigned_char_shl_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
1434 // CHECK-NEXT: entry:
1435 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1436 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1437 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1438 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1439 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1440 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1441 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1442 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1443 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1444 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1445 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1446 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1447 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1448 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1449 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1450 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1451 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1452 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1453 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1454 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1455 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1456 // CHECK-SANITIZE: [[CONT]]:
1457 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1458 // CHECK-NEXT: ret void
1464 // CHECK-LABEL: @unsigned_char_shl_signed_char_signed_char
1465 void unsigned_char_shl_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
1467 // CHECK-NEXT: entry:
1468 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1469 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1470 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1471 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1472 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1473 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1474 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1475 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1476 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1477 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1478 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1479 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1480 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1481 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1482 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1483 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1484 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1485 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1486 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1487 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1488 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1489 // CHECK-SANITIZE: [[CONT]]:
1490 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1491 // CHECK-NEXT: ret void
1497 // CHECK-LABEL: @unsigned_char_shl_signed_char_unsigned_int
1498 void unsigned_char_shl_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
1500 // CHECK-NEXT: entry:
1501 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1502 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1503 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1504 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1505 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1506 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1507 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1508 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1509 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1510 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1511 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1512 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1513 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1514 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1515 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1516 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1517 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1518 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1519 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1520 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1521 // CHECK-SANITIZE: [[CONT]]:
1522 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1523 // CHECK-NEXT: ret void
1529 // CHECK-LABEL: @unsigned_char_shl_signed_char_signed_int
1530 void unsigned_char_shl_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
1532 // CHECK-NEXT: entry:
1533 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1534 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1535 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1536 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1537 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1538 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1539 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1540 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1541 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1542 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1543 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1544 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1545 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1546 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1547 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1548 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1549 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1550 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1551 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1552 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1553 // CHECK-SANITIZE: [[CONT]]:
1554 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1555 // CHECK-NEXT: ret void
1561 // CHECK-LABEL: @signed_char_shl_unsigned_char
1562 void signed_char_shl_unsigned_char(signed char *LHS
, unsigned char RHS
) {
1564 // CHECK-NEXT: entry:
1565 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1566 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1567 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1568 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1569 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1570 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1571 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1572 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1573 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1574 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1575 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1576 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1577 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1578 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1579 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1580 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1581 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1582 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1583 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1584 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1585 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1586 // CHECK-SANITIZE: [[CONT]]:
1587 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1588 // CHECK-NEXT: ret void
1594 // CHECK-LABEL: @signed_char_shl_signed_char
1595 void signed_char_shl_signed_char(signed char *LHS
, signed char RHS
) {
1597 // CHECK-NEXT: entry:
1598 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1599 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1600 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1601 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1602 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1603 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1604 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1605 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1606 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1607 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHSEXT]]
1608 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1609 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1610 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1611 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1612 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1613 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1614 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1615 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1616 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1617 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1618 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1619 // CHECK-SANITIZE: [[CONT]]:
1620 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1621 // CHECK-NEXT: ret void
1627 // CHECK-LABEL: @signed_char_shl_signed_char_unsigned_int
1628 void signed_char_shl_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1630 // CHECK-NEXT: entry:
1631 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1632 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1633 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1634 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1635 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1636 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1637 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1638 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1639 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1640 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1641 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1642 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1643 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1644 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1645 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1646 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1647 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1648 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1649 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1650 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1651 // CHECK-SANITIZE: [[CONT]]:
1652 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1653 // CHECK-NEXT: ret void
1659 // CHECK-LABEL: @signed_char_shl_signed_char_signed_int
1660 void signed_char_shl_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1662 // CHECK-NEXT: entry:
1663 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1664 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1665 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1666 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1667 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1668 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1669 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1670 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1671 // CHECK-NEXT: %[[SRC:.*]] = shl i32 %[[LHSEXT]], %[[RHS]]
1672 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1673 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1674 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1675 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1676 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1677 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1678 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1679 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1680 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1681 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1682 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1683 // CHECK-SANITIZE: [[CONT]]:
1684 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1685 // CHECK-NEXT: ret void
1691 //----------------------------------------------------------------------------//
1692 // Compound right-shift operator. //
1693 //----------------------------------------------------------------------------//
1695 // CHECK-LABEL: @unsigned_char_shr_signed_char_unsigned_char
1696 void unsigned_char_shr_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
1698 // CHECK-NEXT: entry:
1699 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1700 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1701 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1702 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1703 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1704 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1705 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1706 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1707 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1708 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1709 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1710 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1711 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1712 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1713 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1714 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1715 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1716 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_4900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1717 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_4900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1718 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1719 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1720 // CHECK-SANITIZE: [[CONT]]:
1721 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1722 // CHECK-NEXT: ret void
1728 // CHECK-LABEL: @unsigned_char_shr_signed_char_signed_char
1729 void unsigned_char_shr_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
1731 // CHECK-NEXT: entry:
1732 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1733 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1734 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1735 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1736 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1737 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1738 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1739 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1740 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1741 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1742 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1743 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1744 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1745 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1746 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1747 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1748 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1749 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1750 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1751 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1752 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1753 // CHECK-SANITIZE: [[CONT]]:
1754 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1755 // CHECK-NEXT: ret void
1761 // CHECK-LABEL: @unsigned_char_shr_signed_char_unsigned_int
1762 void unsigned_char_shr_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
1764 // CHECK-NEXT: entry:
1765 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1766 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1767 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1768 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1769 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1770 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1771 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1772 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1773 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1774 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1775 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1776 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1777 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1778 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1779 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1780 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1781 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1782 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1783 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1784 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1785 // CHECK-SANITIZE: [[CONT]]:
1786 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1787 // CHECK-NEXT: ret void
1793 // CHECK-LABEL: @unsigned_char_shr_signed_char_signed_int
1794 void unsigned_char_shr_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
1796 // CHECK-NEXT: entry:
1797 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1798 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1799 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1800 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1801 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1802 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1803 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1804 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1805 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1806 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1807 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1808 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1809 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1810 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1811 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1812 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1813 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1814 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1815 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1816 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1817 // CHECK-SANITIZE: [[CONT]]:
1818 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1819 // CHECK-NEXT: ret void
1825 // CHECK-LABEL: @signed_char_shr_unsigned_char
1826 void signed_char_shr_unsigned_char(signed char *LHS
, unsigned char RHS
) {
1828 // CHECK-NEXT: entry:
1829 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1830 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1831 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1832 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1833 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1834 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1835 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1836 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1837 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1838 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1839 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1840 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1841 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1842 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1843 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1844 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1845 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1846 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1847 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1848 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1849 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1850 // CHECK-SANITIZE: [[CONT]]:
1851 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1852 // CHECK-NEXT: ret void
1858 // CHECK-LABEL: @signed_char_shr_signed_char
1859 void signed_char_shr_signed_char(signed char *LHS
, signed char RHS
) {
1861 // CHECK-NEXT: entry:
1862 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1863 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1864 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1865 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1866 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1867 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
1868 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1869 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1870 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1871 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHSEXT]]
1872 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1873 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1874 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1875 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1876 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1877 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1878 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1879 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1880 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1881 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1882 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1883 // CHECK-SANITIZE: [[CONT]]:
1884 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1885 // CHECK-NEXT: ret void
1891 // CHECK-LABEL: @signed_char_shr_signed_char_unsigned_int
1892 void signed_char_shr_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
1894 // CHECK-NEXT: entry:
1895 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1896 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1897 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1898 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1899 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1900 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1901 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1902 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1903 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1904 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1905 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1906 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1907 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1908 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1909 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1910 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1911 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1912 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1913 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1914 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1915 // CHECK-SANITIZE: [[CONT]]:
1916 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1917 // CHECK-NEXT: ret void
1923 // CHECK-LABEL: @signed_char_shr_signed_char_signed_int
1924 void signed_char_shr_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
1926 // CHECK-NEXT: entry:
1927 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1928 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
1929 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1930 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
1931 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
1932 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1933 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1934 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
1935 // CHECK-NEXT: %[[SRC:.*]] = ashr i32 %[[LHSEXT]], %[[RHS]]
1936 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1937 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
1938 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1939 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1940 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1941 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1942 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1943 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1944 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1945 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1946 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1947 // CHECK-SANITIZE: [[CONT]]:
1948 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1949 // CHECK-NEXT: ret void
1955 //----------------------------------------------------------------------------//
1956 // Compound and operator. //
1957 //----------------------------------------------------------------------------//
1959 // CHECK-LABEL: @unsigned_char_and_signed_char_unsigned_char
1960 void unsigned_char_and_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
1962 // CHECK-NEXT: entry:
1963 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1964 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1965 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1966 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
1967 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
1968 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
1969 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
1970 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
1971 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
1972 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
1973 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
1974 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
1975 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
1976 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
1977 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
1978 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
1979 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
1980 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1981 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
1982 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
1983 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
1984 // CHECK-SANITIZE: [[CONT]]:
1985 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
1986 // CHECK-NEXT: ret void
1992 // CHECK-LABEL: @unsigned_char_and_signed_char_signed_char
1993 void unsigned_char_and_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
1995 // CHECK-NEXT: entry:
1996 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
1997 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
1998 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
1999 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2000 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2001 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2002 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2003 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2004 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2005 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
2006 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2007 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2008 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2009 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2010 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2011 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2012 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2013 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2014 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2015 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2016 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2017 // CHECK-SANITIZE: [[CONT]]:
2018 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2019 // CHECK-NEXT: ret void
2025 // CHECK-LABEL: @unsigned_char_and_signed_char_unsigned_int
2026 void unsigned_char_and_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
2028 // CHECK-NEXT: entry:
2029 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2030 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2031 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2032 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2033 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2034 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2035 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2036 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2037 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2038 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2039 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2040 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2041 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2042 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2043 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2044 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2045 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_5900_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2046 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_5900_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2047 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2048 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2049 // CHECK-SANITIZE: [[CONT]]:
2050 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2051 // CHECK-NEXT: ret void
2057 // CHECK-LABEL: @unsigned_char_and_signed_char_signed_int
2058 void unsigned_char_and_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
2060 // CHECK-NEXT: entry:
2061 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2062 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2063 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2064 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2065 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2066 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2067 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2068 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2069 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2070 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2071 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2072 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2073 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2074 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2075 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2076 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2077 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2078 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2079 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2080 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2081 // CHECK-SANITIZE: [[CONT]]:
2082 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2083 // CHECK-NEXT: ret void
2089 // CHECK-LABEL: @signed_char_and_unsigned_char
2090 void signed_char_and_unsigned_char(signed char *LHS
, unsigned char RHS
) {
2092 // CHECK-NEXT: entry:
2093 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2094 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2095 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2096 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2097 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2098 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2099 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2100 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2101 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2102 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
2103 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2104 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2105 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2106 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2107 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2108 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2109 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2110 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2111 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2112 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2113 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2114 // CHECK-SANITIZE: [[CONT]]:
2115 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2116 // CHECK-NEXT: ret void
2122 // CHECK-LABEL: @signed_char_and_signed_char
2123 void signed_char_and_signed_char(signed char *LHS
, signed char RHS
) {
2125 // CHECK-NEXT: entry:
2126 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2127 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2128 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2129 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2130 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2131 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2132 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2133 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2134 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2135 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHSEXT]]
2136 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2137 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2138 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2139 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2140 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2141 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2142 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2143 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2144 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2145 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2146 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2147 // CHECK-SANITIZE: [[CONT]]:
2148 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2149 // CHECK-NEXT: ret void
2155 // CHECK-LABEL: @signed_char_and_signed_char_unsigned_int
2156 void signed_char_and_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
2158 // CHECK-NEXT: entry:
2159 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2160 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2161 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2162 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2163 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2164 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2165 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2166 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2167 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2168 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2169 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2170 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2171 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2172 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2173 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2174 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2175 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2176 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2177 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2178 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2179 // CHECK-SANITIZE: [[CONT]]:
2180 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2181 // CHECK-NEXT: ret void
2187 // CHECK-LABEL: @signed_char_and_signed_char_signed_int
2188 void signed_char_and_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
2190 // CHECK-NEXT: entry:
2191 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2192 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2193 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2194 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2195 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2196 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2197 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2198 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2199 // CHECK-NEXT: %[[SRC:.*]] = and i32 %[[LHSEXT]], %[[RHS]]
2200 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2201 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2202 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2203 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2204 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2205 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2206 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2207 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2208 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2209 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2210 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2211 // CHECK-SANITIZE: [[CONT]]:
2212 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2213 // CHECK-NEXT: ret void
2219 //----------------------------------------------------------------------------//
2220 // Compound xor operator. //
2221 //----------------------------------------------------------------------------//
2223 // CHECK-LABEL: @unsigned_char_or_signed_char_unsigned_char
2224 void unsigned_char_or_signed_char_unsigned_char(unsigned char *LHS
, unsigned 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:.*]] = zext 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:.*]] = zext 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: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2239 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2240 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2241 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2242 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2243 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2244 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2245 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6500_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2246 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2247 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2248 // CHECK-SANITIZE: [[CONT]]:
2249 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2250 // CHECK-NEXT: ret void
2256 // CHECK-LABEL: @unsigned_char_or_signed_char_signed_char
2257 void unsigned_char_or_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
2259 // CHECK-NEXT: entry:
2260 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2261 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2262 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2263 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2264 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2265 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2266 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2267 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2268 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2269 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2270 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2271 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2272 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2273 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], 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_6600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2278 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6600_SIGNED_TRUNCATION]], 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: @unsigned_char_or_signed_char_unsigned_int
2290 void unsigned_char_or_signed_char_unsigned_int(unsigned char *LHS
, unsigned 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:.*]] = zext 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: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2304 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2305 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2306 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2307 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2308 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2309 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6700_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2310 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6700_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2311 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2312 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2313 // CHECK-SANITIZE: [[CONT]]:
2314 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2315 // CHECK-NEXT: ret void
2321 // CHECK-LABEL: @unsigned_char_or_signed_char_signed_int
2322 void unsigned_char_or_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
2324 // CHECK-NEXT: entry:
2325 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2326 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2327 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2328 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2329 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2330 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2331 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2332 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2333 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2334 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2335 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2336 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2337 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2338 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2339 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2340 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2341 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2342 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2343 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2344 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2345 // CHECK-SANITIZE: [[CONT]]:
2346 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2347 // CHECK-NEXT: ret void
2353 // CHECK-LABEL: @signed_char_or_unsigned_char
2354 void signed_char_or_unsigned_char(signed char *LHS
, unsigned char RHS
) {
2356 // CHECK-NEXT: entry:
2357 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2358 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2359 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2360 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2361 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2362 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2363 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2364 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2365 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2366 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2367 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2368 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2369 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2370 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2371 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2372 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2373 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2374 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_6900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2375 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_6900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2376 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2377 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2378 // CHECK-SANITIZE: [[CONT]]:
2379 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2380 // CHECK-NEXT: ret void
2386 // CHECK-LABEL: @signed_char_or_signed_char
2387 void signed_char_or_signed_char(signed char *LHS
, signed char RHS
) {
2389 // CHECK-NEXT: entry:
2390 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2391 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2392 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2393 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2394 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2395 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2396 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2397 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2398 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2399 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHSEXT]]
2400 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2401 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2402 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2403 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2404 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2405 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2406 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2407 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2408 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2409 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2410 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2411 // CHECK-SANITIZE: [[CONT]]:
2412 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2413 // CHECK-NEXT: ret void
2419 // CHECK-LABEL: @signed_char_or_signed_char_unsigned_int
2420 void signed_char_or_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
2422 // CHECK-NEXT: entry:
2423 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2424 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2425 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2426 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2427 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2428 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2429 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2430 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2431 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2432 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2433 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2434 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2435 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2436 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2437 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2438 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2439 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2440 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7100_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2441 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2442 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2443 // CHECK-SANITIZE: [[CONT]]:
2444 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2445 // CHECK-NEXT: ret void
2451 // CHECK-LABEL: @signed_char_or_signed_char_signed_int
2452 void signed_char_or_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
2454 // CHECK-NEXT: entry:
2455 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2456 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2457 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2458 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2459 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2460 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2461 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2462 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2463 // CHECK-NEXT: %[[SRC:.*]] = or i32 %[[LHSEXT]], %[[RHS]]
2464 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2465 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2466 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2467 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2468 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2469 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2470 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2471 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2472 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7200_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2473 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2474 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2475 // CHECK-SANITIZE: [[CONT]]:
2476 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2477 // CHECK-NEXT: ret void
2483 //----------------------------------------------------------------------------//
2484 // Compound or operator. //
2485 //----------------------------------------------------------------------------//
2487 // CHECK-LABEL: @unsigned_char_xor_signed_char_unsigned_char
2488 void unsigned_char_xor_signed_char_unsigned_char(unsigned char *LHS
, unsigned char RHS
) {
2490 // CHECK-NEXT: entry:
2491 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2492 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2493 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2494 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2495 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2496 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2497 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2498 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2499 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2500 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2501 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2502 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2503 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2504 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2505 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2506 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2507 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2508 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2509 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7300_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2510 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2511 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2512 // CHECK-SANITIZE: [[CONT]]:
2513 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2514 // CHECK-NEXT: ret void
2520 // CHECK-LABEL: @unsigned_char_xor_signed_char_signed_char
2521 void unsigned_char_xor_signed_char_signed_char(unsigned char *LHS
, signed char RHS
) {
2523 // CHECK-NEXT: entry:
2524 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2525 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2526 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2527 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2528 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2529 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2530 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2531 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2532 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2533 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2534 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2535 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2536 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2537 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2538 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2539 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2540 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2541 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2542 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7400_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2543 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2544 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2545 // CHECK-SANITIZE: [[CONT]]:
2546 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2547 // CHECK-NEXT: ret void
2553 // CHECK-LABEL: @unsigned_char_xor_signed_char_unsigned_int
2554 void unsigned_char_xor_signed_char_unsigned_int(unsigned char *LHS
, unsigned int RHS
) {
2556 // CHECK-NEXT: entry:
2557 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2558 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2559 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2560 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2561 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2562 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2563 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2564 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2565 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2566 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2567 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2568 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2569 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2570 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2571 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2572 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2573 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7500_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2574 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7500_UNSIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2575 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2576 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2577 // CHECK-SANITIZE: [[CONT]]:
2578 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2579 // CHECK-NEXT: ret void
2585 // CHECK-LABEL: @unsigned_char_xor_signed_char_signed_int
2586 void unsigned_char_xor_signed_char_signed_int(unsigned char *LHS
, signed int RHS
) {
2588 // CHECK-NEXT: entry:
2589 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2590 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2591 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2592 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2593 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2594 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2595 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2596 // CHECK-NEXT: %[[LHSEXT:.*]] = zext i8 %[[LHS]] to i32
2597 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2598 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2599 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = zext i8 %[[DST]] to i32, !nosanitize
2600 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2601 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2602 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2603 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2604 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2605 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2606 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7600_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2607 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2608 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2609 // CHECK-SANITIZE: [[CONT]]:
2610 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2611 // CHECK-NEXT: ret void
2617 // CHECK-LABEL: @signed_char_xor_unsigned_char
2618 void signed_char_xor_unsigned_char(signed char *LHS
, unsigned char RHS
) {
2620 // CHECK-NEXT: entry:
2621 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2622 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2623 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2624 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2625 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2626 // CHECK-NEXT: %[[RHSEXT:.*]] = zext i8 %[[RHS]] to i32
2627 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2628 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2629 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2630 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2631 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2632 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2633 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2634 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2635 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2636 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2637 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2638 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2639 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7700_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2640 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2641 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2642 // CHECK-SANITIZE: [[CONT]]:
2643 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2644 // CHECK-NEXT: ret void
2650 // CHECK-LABEL: @signed_char_xor_signed_char
2651 void signed_char_xor_signed_char(signed char *LHS
, signed char RHS
) {
2653 // CHECK-NEXT: entry:
2654 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2655 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i8, align 1
2656 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2657 // CHECK-NEXT: store i8 %[[ARG1:.*]], ptr %[[RHSADDR]], align 1
2658 // CHECK-NEXT: %[[RHS:.*]] = load i8, ptr %[[RHSADDR]], align 1
2659 // CHECK-NEXT: %[[RHSEXT:.*]] = sext i8 %[[RHS]] to i32
2660 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2661 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2662 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2663 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHSEXT]]
2664 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2665 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2666 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2667 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2668 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2669 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2670 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2671 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2672 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7800_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2673 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2674 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2675 // CHECK-SANITIZE: [[CONT]]:
2676 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2677 // CHECK-NEXT: ret void
2683 // CHECK-LABEL: @signed_char_xor_signed_char_unsigned_int
2684 void signed_char_xor_signed_char_unsigned_int(signed char *LHS
, unsigned int RHS
) {
2686 // CHECK-NEXT: entry:
2687 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2688 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2689 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2690 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2691 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2692 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2693 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2694 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2695 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2696 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2697 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2698 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2699 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2700 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2701 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2702 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2703 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_7900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2704 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_7900_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2705 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2706 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2707 // CHECK-SANITIZE: [[CONT]]:
2708 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2709 // CHECK-NEXT: ret void
2715 // CHECK-LABEL: @signed_char_xor_signed_char_signed_int
2716 void signed_char_xor_signed_char_signed_int(signed char *LHS
, signed int RHS
) {
2718 // CHECK-NEXT: entry:
2719 // CHECK-NEXT: %[[ADDRESS:.*]] = alloca ptr, align 8
2720 // CHECK-NEXT: %[[RHSADDR:.*]] = alloca i32, align 4
2721 // CHECK-NEXT: store ptr %[[ARG0:.*]], ptr %[[ADDRESS]], align 8
2722 // CHECK-NEXT: store i32 %[[ARG1:.*]], ptr %[[RHSADDR]], align 4
2723 // CHECK-NEXT: %[[RHS:.*]] = load i32, ptr %[[RHSADDR]], align 4
2724 // CHECK-NEXT: %[[LHSADDR:.*]] = load ptr, ptr %[[ADDRESS]], align 8
2725 // CHECK-NEXT: %[[LHS:.*]] = load i8, ptr %[[LHSADDR]], align 1
2726 // CHECK-NEXT: %[[LHSEXT:.*]] = sext i8 %[[LHS]] to i32
2727 // CHECK-NEXT: %[[SRC:.*]] = xor i32 %[[LHSEXT]], %[[RHS]]
2728 // CHECK-NEXT: %[[DST:.*]] = trunc i32 %[[SRC]] to i8
2729 // CHECK-SANITIZE-NEXT: %[[ANYEXT:.*]] = sext i8 %[[DST]] to i32, !nosanitize
2730 // CHECK-SANITIZE-NEXT: %[[TRUNCHECK:.*]] = icmp eq i32 %[[ANYEXT]], %[[SRC]], !nosanitize
2731 // CHECK-SANITIZE-NEXT: br i1 %[[TRUNCHECK]], label %[[CONT:.*]], label %[[HANDLER_IMPLICIT_CONVERSION:[^,]+]],{{.*}} !nosanitize
2732 // CHECK-SANITIZE: [[HANDLER_IMPLICIT_CONVERSION]]:
2733 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTSRC:.*]] = zext i32 %[[SRC]] to i64, !nosanitize
2734 // CHECK-SANITIZE-ANYRECOVER-NEXT: %[[EXTDST:.*]] = zext i8 %[[DST]] to i64, !nosanitize
2735 // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_implicit_conversion_abort(ptr @[[LINE_8000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2736 // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_8000_SIGNED_TRUNCATION]], i64 %[[EXTSRC]], i64 %[[EXTDST]]){{.*}}, !nosanitize
2737 // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 7){{.*}}, !nosanitize
2738 // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
2739 // CHECK-SANITIZE: [[CONT]]:
2740 // CHECK-NEXT: store i8 %[[DST]], ptr %[[LHSADDR]], align 1
2741 // CHECK-NEXT: ret void