1; RUN: llc -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s 2target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 3target triple = "arm64" 4 5define i1 @test_EQ_IllEbT(i64 %a, i64 %b) { 6; CHECK-LABEL: test_EQ_IllEbT 7; CHECK: cmn x1, x0 8; CHECK-NEXT: cset w0, eq 9; CHECK-NEXT: ret 10entry: 11 %add = sub i64 0, %b 12 %cmp = icmp eq i64 %add, %a 13 ret i1 %cmp 14} 15 16define i1 @test_EQ_IliEbT(i64 %a, i32 %b) { 17; CHECK-LABEL: test_EQ_IliEbT 18; CHECK: cmn x0, w1, sxtw 19; CHECK-NEXT: cset w0, eq 20; CHECK-NEXT: ret 21entry: 22 %conv = sext i32 %b to i64 23 %add = sub i64 0, %a 24 %cmp = icmp eq i64 %conv, %add 25 ret i1 %cmp 26} 27 28define i1 @test_EQ_IlsEbT(i64 %a, i16 %b) { 29; CHECK-LABEL: test_EQ_IlsEbT 30; CHECK: cmn x0, w1, sxth 31; CHECK-NEXT: cset w0, eq 32; CHECK-NEXT: ret 33entry: 34 %conv = sext i16 %b to i64 35 %add = sub i64 0, %a 36 %cmp = icmp eq i64 %conv, %add 37 ret i1 %cmp 38} 39 40define i1 @test_EQ_IlcEbT(i64 %a, i8 %b) { 41; CHECK-LABEL: test_EQ_IlcEbT 42; CHECK: cmn x0, w1, uxtb 43; CHECK-NEXT: cset w0, eq 44; CHECK-NEXT: ret 45entry: 46 %conv = zext i8 %b to i64 47 %add = sub i64 0, %a 48 %cmp = icmp eq i64 %conv, %add 49 ret i1 %cmp 50} 51 52define i1 @test_EQ_IilEbT(i32 %a, i64 %b) { 53; CHECK-LABEL: test_EQ_IilEbT 54; CHECK: cmn x1, w0, sxtw 55; CHECK-NEXT: cset w0, eq 56; CHECK-NEXT: ret 57entry: 58 %conv = sext i32 %a to i64 59 %add = sub i64 0, %b 60 %cmp = icmp eq i64 %conv, %add 61 ret i1 %cmp 62} 63 64define i1 @test_EQ_IiiEbT(i32 %a, i32 %b) { 65; CHECK-LABEL: test_EQ_IiiEbT 66; CHECK: cmn w1, w0 67; CHECK-NEXT: cset w0, eq 68; CHECK-NEXT: ret 69entry: 70 %add = sub i32 0, %b 71 %cmp = icmp eq i32 %add, %a 72 ret i1 %cmp 73} 74 75define i1 @test_EQ_IisEbT(i32 %a, i16 %b) { 76; CHECK-LABEL: test_EQ_IisEbT 77; CHECK: cmn w0, w1, sxth 78; CHECK-NEXT: cset w0, eq 79; CHECK-NEXT: ret 80entry: 81 %conv = sext i16 %b to i32 82 %add = sub i32 0, %a 83 %cmp = icmp eq i32 %conv, %add 84 ret i1 %cmp 85} 86 87define i1 @test_EQ_IicEbT(i32 %a, i8 %b) { 88; CHECK-LABEL: test_EQ_IicEbT 89; CHECK: cmn w0, w1, uxtb 90; CHECK-NEXT: cset w0, eq 91; CHECK-NEXT: ret 92entry: 93 %conv = zext i8 %b to i32 94 %add = sub i32 0, %a 95 %cmp = icmp eq i32 %conv, %add 96 ret i1 %cmp 97} 98 99define i1 @test_EQ_IslEbT(i16 %a, i64 %b) { 100; CHECK-LABEL: test_EQ_IslEbT 101; CHECK: cmn x1, w0, sxth 102; CHECK-NEXT: cset w0, eq 103; CHECK-NEXT: ret 104entry: 105 %conv = sext i16 %a to i64 106 %add = sub i64 0, %b 107 %cmp = icmp eq i64 %conv, %add 108 ret i1 %cmp 109} 110 111define i1 @test_EQ_IsiEbT(i16 %a, i32 %b) { 112; CHECK-LABEL: test_EQ_IsiEbT 113; CHECK: cmn w1, w0, sxth 114; CHECK-NEXT: cset w0, eq 115; CHECK-NEXT: ret 116entry: 117 %conv = sext i16 %a to i32 118 %add = sub i32 0, %b 119 %cmp = icmp eq i32 %conv, %add 120 ret i1 %cmp 121} 122 123define i1 @test_EQ_IssEbT(i16 %a, i16 %b) { 124; CHECK-LABEL: test_EQ_IssEbT 125; CHECK: sxth w8, w1 126; CHECK-NEXT: cmn w8, w0, sxth 127; CHECK-NEXT: cset w0, eq 128; CHECK-NEXT; ret 129entry: 130 %conv = sext i16 %a to i32 131 %conv1 = sext i16 %b to i32 132 %add = sub nsw i32 0, %conv1 133 %cmp = icmp eq i32 %conv, %add 134 ret i1 %cmp 135} 136 137define i1 @test_EQ_IscEbT(i16 %a, i8 %b) { 138; CHECK-LABEL: test_EQ_IscEbT 139; CHECK: and w8, w1, #0xff 140; CHECK-NEXT: cmn w8, w0, sxth 141; CHECK-NEXT: cset w0, eq 142; CHECK-NEXT; ret 143entry: 144 %conv = sext i16 %a to i32 145 %conv1 = zext i8 %b to i32 146 %add = sub nsw i32 0, %conv1 147 %cmp = icmp eq i32 %conv, %add 148 ret i1 %cmp 149} 150 151define i1 @test_EQ_IclEbT(i8 %a, i64 %b) { 152; CHECK-LABEL: test_EQ_IclEbT 153; CHECK: cmn x1, w0, uxtb 154; CHECK-NEXT: cset w0, eq 155; CHECK-NEXT: ret 156entry: 157 %conv = zext i8 %a to i64 158 %add = sub i64 0, %b 159 %cmp = icmp eq i64 %conv, %add 160 ret i1 %cmp 161} 162 163define i1 @test_EQ_IciEbT(i8 %a, i32 %b) { 164; CHECK-LABEL: test_EQ_IciEbT 165; CHECK: cmn w1, w0, uxtb 166; CHECK-NEXT: cset w0, eq 167; CHECK-NEXT: ret 168entry: 169 %conv = zext i8 %a to i32 170 %add = sub i32 0, %b 171 %cmp = icmp eq i32 %conv, %add 172 ret i1 %cmp 173} 174 175define i1 @test_EQ_IcsEbT(i8 %a, i16 %b) { 176; CHECK-LABEL: test_EQ_IcsEbT 177; CHECK: sxth w8, w1 178; CHECK-NEXT: cmn w8, w0, uxtb 179; CHECK-NEXT: cset w0, eq 180; CHECK-NEXT: ret 181entry: 182 %conv = zext i8 %a to i32 183 %conv1 = sext i16 %b to i32 184 %add = sub nsw i32 0, %conv1 185 %cmp = icmp eq i32 %conv, %add 186 ret i1 %cmp 187} 188 189define i1 @test_EQ_IccEbT(i8 %a, i8 %b) { 190; CHECK-LABEL: test_EQ_IccEbT 191; CHECK: and w8, w1, #0xff 192; CHECK-NEXT: cmn w8, w0, uxtb 193; CHECK-NEXT: cset w0, eq 194; CHECK-NEXT: ret 195entry: 196 %conv = zext i8 %a to i32 197 %conv1 = zext i8 %b to i32 198 %add = sub nsw i32 0, %conv1 199 %cmp = icmp eq i32 %conv, %add 200 ret i1 %cmp 201} 202 203define i1 @test_NE_IllEbT(i64 %a, i64 %b) { 204; CHECK-LABEL: test_NE_IllEbT 205; CHECK: cmn x1, x0 206; CHECK-NEXT: cset w0, ne 207; CHECK-NEXT: ret 208entry: 209 %add = sub i64 0, %b 210 %cmp = icmp ne i64 %add, %a 211 ret i1 %cmp 212} 213 214define i1 @test_NE_IliEbT(i64 %a, i32 %b) { 215; CHECK-LABEL: test_NE_IliEbT 216; CHECK: cmn x0, w1, sxtw 217; CHECK-NEXT: cset w0, ne 218; CHECK-NEXT: ret 219entry: 220 %conv = sext i32 %b to i64 221 %add = sub i64 0, %a 222 %cmp = icmp ne i64 %conv, %add 223 ret i1 %cmp 224} 225 226define i1 @test_NE_IlsEbT(i64 %a, i16 %b) { 227; CHECK-LABEL: test_NE_IlsEbT 228; CHECK: cmn x0, w1, sxth 229; CHECK-NEXT: cset w0, ne 230; CHECK-NEXT: ret 231entry: 232 %conv = sext i16 %b to i64 233 %add = sub i64 0, %a 234 %cmp = icmp ne i64 %conv, %add 235 ret i1 %cmp 236} 237 238define i1 @test_NE_IlcEbT(i64 %a, i8 %b) { 239; CHECK-LABEL: test_NE_IlcEbT 240; CHECK: cmn x0, w1, uxtb 241; CHECK-NEXT: cset w0, ne 242; CHECK-NEXT: ret 243entry: 244 %conv = zext i8 %b to i64 245 %add = sub i64 0, %a 246 %cmp = icmp ne i64 %conv, %add 247 ret i1 %cmp 248} 249 250define i1 @test_NE_IilEbT(i32 %a, i64 %b) { 251; CHECK-LABEL: test_NE_IilEbT 252; CHECK: cmn x1, w0, sxtw 253; CHECK-NEXT: cset w0, ne 254; CHECK-NEXT: ret 255entry: 256 %conv = sext i32 %a to i64 257 %add = sub i64 0, %b 258 %cmp = icmp ne i64 %conv, %add 259 ret i1 %cmp 260} 261 262define i1 @test_NE_IiiEbT(i32 %a, i32 %b) { 263; CHECK-LABEL: test_NE_IiiEbT 264; CHECK: cmn w1, w0 265; CHECK-NEXT: cset w0, ne 266; CHECK-NEXT: ret 267entry: 268 %add = sub i32 0, %b 269 %cmp = icmp ne i32 %add, %a 270 ret i1 %cmp 271} 272 273define i1 @test_NE_IisEbT(i32 %a, i16 %b) { 274; CHECK-LABEL: test_NE_IisEbT 275; CHECK: cmn w0, w1, sxth 276; CHECK-NEXT: cset w0, ne 277; CHECK-NEXT: ret 278entry: 279 %conv = sext i16 %b to i32 280 %add = sub i32 0, %a 281 %cmp = icmp ne i32 %conv, %add 282 ret i1 %cmp 283} 284 285define i1 @test_NE_IicEbT(i32 %a, i8 %b) { 286; CHECK-LABEL: test_NE_IicEbT 287; CHECK: cmn w0, w1, uxtb 288; CHECK-NEXT: cset w0, ne 289; CHECK-NEXT: ret 290entry: 291 %conv = zext i8 %b to i32 292 %add = sub i32 0, %a 293 %cmp = icmp ne i32 %conv, %add 294 ret i1 %cmp 295} 296 297define i1 @test_NE_IslEbT(i16 %a, i64 %b) { 298; CHECK-LABEL: test_NE_IslEbT 299; CHECK: cmn x1, w0, sxth 300; CHECK-NEXT: cset w0, ne 301; CHECK-NEXT: ret 302entry: 303 %conv = sext i16 %a to i64 304 %add = sub i64 0, %b 305 %cmp = icmp ne i64 %conv, %add 306 ret i1 %cmp 307} 308 309define i1 @test_NE_IsiEbT(i16 %a, i32 %b) { 310; CHECK-LABEL: test_NE_IsiEbT 311; CHECK: cmn w1, w0, sxth 312; CHECK-NEXT: cset w0, ne 313; CHECK-NEXT: ret 314entry: 315 %conv = sext i16 %a to i32 316 %add = sub i32 0, %b 317 %cmp = icmp ne i32 %conv, %add 318 ret i1 %cmp 319} 320 321define i1 @test_NE_IssEbT(i16 %a, i16 %b) { 322; CHECK-LABEL:test_NE_IssEbT 323; CHECK: sxth w8, w1 324; CHECK-NEXT: cmn w8, w0, sxth 325; CHECK-NEXT: cset w0, ne 326; CHECK-NEXT: ret 327entry: 328 %conv = sext i16 %a to i32 329 %conv1 = sext i16 %b to i32 330 %add = sub nsw i32 0, %conv1 331 %cmp = icmp ne i32 %conv, %add 332 ret i1 %cmp 333} 334 335define i1 @test_NE_IscEbT(i16 %a, i8 %b) { 336; CHECK-LABEL:test_NE_IscEbT 337; CHECK: and w8, w1, #0xff 338; CHECK-NEXT: cmn w8, w0, sxth 339; CHECK-NEXT: cset w0, ne 340; CHECK-NEXT: ret 341entry: 342 %conv = sext i16 %a to i32 343 %conv1 = zext i8 %b to i32 344 %add = sub nsw i32 0, %conv1 345 %cmp = icmp ne i32 %conv, %add 346 ret i1 %cmp 347} 348 349define i1 @test_NE_IclEbT(i8 %a, i64 %b) { 350; CHECK-LABEL:test_NE_IclEbT 351; CHECK: cmn x1, w0, uxtb 352; CHECK-NEXT: cset w0, ne 353; CHECK-NEXT: ret 354entry: 355 %conv = zext i8 %a to i64 356 %add = sub i64 0, %b 357 %cmp = icmp ne i64 %conv, %add 358 ret i1 %cmp 359} 360 361define i1 @test_NE_IciEbT(i8 %a, i32 %b) { 362; CHECK-LABEL:test_NE_IciEbT 363; CHECK: cmn w1, w0, uxtb 364; CHECK-NEXT: cset w0, ne 365; CHECK-NEXT: ret 366entry: 367 %conv = zext i8 %a to i32 368 %add = sub i32 0, %b 369 %cmp = icmp ne i32 %conv, %add 370 ret i1 %cmp 371} 372 373define i1 @test_NE_IcsEbT(i8 %a, i16 %b) { 374; CHECK-LABEL:test_NE_IcsEbT 375; CHECK: sxth w8, w1 376; CHECK-NEXT: cmn w8, w0, uxtb 377; CHECK-NEXT: cset w0, ne 378; CHECK-NEXT: ret 379entry: 380 %conv = zext i8 %a to i32 381 %conv1 = sext i16 %b to i32 382 %add = sub nsw i32 0, %conv1 383 %cmp = icmp ne i32 %conv, %add 384 ret i1 %cmp 385} 386 387define i1 @test_NE_IccEbT(i8 %a, i8 %b) { 388; CHECK-LABEL:test_NE_IccEbT 389; CHECK: and w8, w1, #0xff 390; CHECK-NEXT: cmn w8, w0, uxtb 391; CHECK-NEXT: cset w0, ne 392; CHECK-NEXT: ret 393entry: 394 %conv = zext i8 %a to i32 395 %conv1 = zext i8 %b to i32 396 %add = sub nsw i32 0, %conv1 397 %cmp = icmp ne i32 %conv, %add 398 ret i1 %cmp 399} 400