# RUN: llvm-mc -triple hexagon -disassemble < %s | FileCheck %s
# Hexagon Programmer's Reference Manual 11.1.3 ALU32/PRED

# Conditional add
0xf1 0xc3 0x75 0x74
# CHECK: if (p3) r17 = add(r21,#31)
0x03 0x40 0x45 0x85 0xf1 0xe3 0x75 0x74
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = add(r21,#31)
0xf1 0xc3 0xf5 0x74
# CHECK: if (!p3) r17 = add(r21,#31)
0x03 0x40 0x45 0x85 0xf1 0xe3 0xf5 0x74
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = add(r21,#31)
0x71 0xdf 0x15 0xfb
# CHECK: if (p3) r17 = add(r21,r31)
0x03 0x40 0x45 0x85 0x71 0xff 0x15 0xfb
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = add(r21,r31)
0xf1 0xdf 0x15 0xfb
# CHECK: if (!p3) r17 = add(r21,r31)
0x03 0x40 0x45 0x85 0xf1 0xff 0x15 0xfb
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = add(r21,r31)

# Conditional shift halfword
0x11 0xe3 0x15 0x70
# CHECK: if (p3) r17 = aslh(r21)
0x03 0x40 0x45 0x85 0x11 0xe7 0x15 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = aslh(r21)
0x11 0xeb 0x15 0x70
# CHECK: if (!p3) r17 = aslh(r21)
0x03 0x40 0x45 0x85 0x11 0xef 0x15 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = aslh(r21)
0x11 0xe3 0x35 0x70
# CHECK: if (p3) r17 = asrh(r21)
0x03 0x40 0x45 0x85 0x11 0xe7 0x35 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = asrh(r21)
0x11 0xeb 0x35 0x70
# CHECK: if (!p3) r17 = asrh(r21)
0x03 0x40 0x45 0x85 0x11 0xef 0x35 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = asrh(r21)

# Conditional combine
0x70 0xdf 0x15 0xfd
# CHECK: if (p3) r17:16 = combine(r21,r31)
0xf0 0xdf 0x15 0xfd
# CHECK: if (!p3) r17:16 = combine(r21,r31)
0x03 0x40 0x45 0x85 0x70 0xff 0x15 0xfd
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17:16 = combine(r21,r31)
0x03 0x40 0x45 0x85 0xf0 0xff 0x15 0xfd
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17:16 = combine(r21,r31)

# Conditional logical operations
0x71 0xdf 0x15 0xf9
# CHECK: if (p3) r17 = and(r21,r31)
0xf1 0xdf 0x15 0xf9
# CHECK: if (!p3) r17 = and(r21,r31)
0x03 0x40 0x45 0x85 0x71 0xff 0x15 0xf9
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = and(r21,r31)
0x03 0x40 0x45 0x85 0xf1 0xff 0x15 0xf9
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = and(r21,r31)
0x71 0xdf 0x35 0xf9
# CHECK: if (p3) r17 = or(r21,r31)
0xf1 0xdf 0x35 0xf9
# CHECK: if (!p3) r17 = or(r21,r31)
0x03 0x40 0x45 0x85 0x71 0xff 0x35 0xf9
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = or(r21,r31)
0x03 0x40 0x45 0x85 0xf1 0xff 0x35 0xf9
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = or(r21,r31)
0x71 0xdf 0x75 0xf9
# CHECK: if (p3) r17 = xor(r21,r31)
0xf1 0xdf 0x75 0xf9
# CHECK: if (!p3) r17 = xor(r21,r31)
0x03 0x40 0x45 0x85 0x71 0xff 0x75 0xf9
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = xor(r21,r31)
0x03 0x40 0x45 0x85 0xf1 0xff 0x75 0xf9
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = xor(r21,r31)

# Conditional subtract
0x71 0xdf 0x35 0xfb
# CHECK: if (p3) r17 = sub(r31,r21)
0xf1 0xdf 0x35 0xfb
# CHECK: if (!p3) r17 = sub(r31,r21)
0x03 0x40 0x45 0x85 0x71 0xff 0x35 0xfb
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = sub(r31,r21)
0x03 0x40 0x45 0x85 0xf1 0xff 0x35 0xfb
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = sub(r31,r21)

# Conditional sign extend
0x11 0xe3 0xb5 0x70
# CHECK: if (p3) r17 = sxtb(r21)
0x11 0xeb 0xb5 0x70
# CHECK: if (!p3) r17 = sxtb(r21)
0x03 0x40 0x45 0x85 0x11 0xe7 0xb5 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = sxtb(r21)
0x03 0x40 0x45 0x85 0x11 0xef 0xb5 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = sxtb(r21)
0x11 0xe3 0xf5 0x70
# CHECK: if (p3) r17 = sxth(r21)
0x11 0xeb 0xf5 0x70
# CHECK: if (!p3) r17 = sxth(r21)
0x03 0x40 0x45 0x85 0x11 0xe7 0xf5 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = sxth(r21)
0x03 0x40 0x45 0x85 0x11 0xef 0xf5 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = sxth(r21)

# Conditional transfer
0xb1 0xc2 0x60 0x7e
# CHECK: if (p3) r17 = #21
0xb1 0xc2 0xe0 0x7e
# CHECK: if (!p3) r17 = #21
0x03 0x40 0x45 0x85 0xb1 0xe2 0x60 0x7e
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = #21
0x03 0x40 0x45 0x85 0xb1 0xe2 0xe0 0x7e
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = #21

# Conditional zero extend
0x11 0xe3 0x95 0x70
# CHECK: if (p3) r17 = zxtb(r21)
0x11 0xeb 0x95 0x70
# CHECK: if (!p3) r17 = zxtb(r21)
0x03 0x40 0x45 0x85 0x11 0xe7 0x95 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = zxtb(r21)
0x03 0x40 0x45 0x85 0x11 0xef 0x95 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = zxtb(r21)
0x11 0xe3 0xd5 0x70
# CHECK: if (p3) r17 = zxth(r21)
0x11 0xeb 0xd5 0x70
# CHECK: if (!p3) r17 = zxth(r21)
0x03 0x40 0x45 0x85 0x11 0xe7 0xd5 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (p3.new) r17 = zxth(r21)
0x03 0x40 0x45 0x85 0x11 0xef 0xd5 0x70
# CHECK: p3 = r5
# CHECK-NEXT: if (!p3.new) r17 = zxth(r21)

# Compare
0xe3 0xc3 0x15 0x75
# CHECK: p3 = cmp.eq(r21,#31)
0xf3 0xc3 0x15 0x75
# CHECK: p3 = !cmp.eq(r21,#31)
0xe3 0xc3 0x55 0x75
# CHECK: p3 = cmp.gt(r21,#31)
0xf3 0xc3 0x55 0x75
# CHECK: p3 = !cmp.gt(r21,#31)
0xe3 0xc3 0x95 0x75
# CHECK: p3 = cmp.gtu(r21,#31)
0xf3 0xc3 0x95 0x75
# CHECK: p3 = !cmp.gtu(r21,#31)
0x03 0xdf 0x15 0xf2
# CHECK: p3 = cmp.eq(r21,r31)
0x13 0xdf 0x15 0xf2
# CHECK: p3 = !cmp.eq(r21,r31)
0x03 0xdf 0x55 0xf2
# CHECK: p3 = cmp.gt(r21,r31)
0x13 0xdf 0x55 0xf2
# CHECK: p3 = !cmp.gt(r21,r31)
0x03 0xdf 0x75 0xf2
# CHECK: p3 = cmp.gtu(r21,r31)
0x13 0xdf 0x75 0xf2
# CHECK: p3 = !cmp.gtu(r21,r31)

# Compare to general register
0xf1 0xe3 0x55 0x73
# CHECK: r17 = cmp.eq(r21,#31)
0xf1 0xe3 0x75 0x73
# CHECK: r17 = !cmp.eq(r21,#31)
0x11 0xdf 0x55 0xf3
# CHECK: r17 = cmp.eq(r21,r31)
0x11 0xdf 0x75 0xf3
# CHECK: r17 = !cmp.eq(r21,r31)
