# RUN: llvm-mc -triple=hexagon -disassemble < %s | FileCheck %s
# Hexagon Programmer's Reference Manual 11.10.4 XTYPE/FP

# Floating point addition
0x11 0xdf 0x15 0xeb
# CHECK: r17 = sfadd(r21,r31)

# Classify floating-point value
0x03 0xd5 0xf1 0x85
# CHECK: p3 = sfclass(r17,#21)
0xb3 0xc2 0x90 0xdc
# CHECK: p3 = dfclass(r17:16,#21)

# Compare floating-point value
0x03 0xd5 0xf1 0xc7
# CHECK: p3 = sfcmp.ge(r17,r21)
0x23 0xd5 0xf1 0xc7
# CHECK: p3 = sfcmp.uo(r17,r21)
0x63 0xd5 0xf1 0xc7
# CHECK: p3 = sfcmp.eq(r17,r21)
0x83 0xd5 0xf1 0xc7
# CHECK: p3 = sfcmp.gt(r17,r21)
0x03 0xd4 0xf0 0xd2
# CHECK: p3 = dfcmp.eq(r17:16,r21:20)
0x23 0xd4 0xf0 0xd2
# CHECK: p3 = dfcmp.gt(r17:16,r21:20)
0x43 0xd4 0xf0 0xd2
# CHECK: p3 = dfcmp.ge(r17:16,r21:20)
0x63 0xd4 0xf0 0xd2
# CHECK: p3 = dfcmp.uo(r17:16,r21:20)

# Convert floating-point value to other format
0x10 0xc0 0x95 0x84
# CHECK: r17:16 = convert_sf2df(r21)
0x31 0xc0 0x14 0x88
# CHECK: r17 = convert_df2sf(r21:20)

# Convert integer to floating-point value
0x50 0xc0 0xf4 0x80
# CHECK: r17:16 = convert_ud2df(r21:20)
0x70 0xc0 0xf4 0x80
# CHECK: r17:16 = convert_d2df(r21:20)
0x30 0xc0 0x95 0x84
# CHECK: r17:16 = convert_uw2df(r21)
0x50 0xc0 0x95 0x84
# CHECK: r17:16 = convert_w2df(r21)
0x31 0xc0 0x34 0x88
# CHECK: r17 = convert_ud2sf(r21:20)
0x31 0xc0 0x54 0x88
# CHECK: r17 = convert_d2sf(r21:20)
0x11 0xc0 0x35 0x8b
# CHECK: r17 = convert_uw2sf(r21)
0x11 0xc0 0x55 0x8b
# CHECK: r17 = convert_w2sf(r21)

# Convert floating-point value to integer
0x10 0xc0 0xf4 0x80
# CHECK: r17:16 = convert_df2d(r21:20)
0x30 0xc0 0xf4 0x80
# CHECK: r17:16 = convert_df2ud(r21:20)
0xd0 0xc0 0xf4 0x80
# CHECK: r17:16 = convert_df2d(r21:20):chop
0xf0 0xc0 0xf4 0x80
# CHECK: r17:16 = convert_df2ud(r21:20):chop
0x70 0xc0 0x95 0x84
# CHECK: r17:16 = convert_sf2ud(r21)
0x90 0xc0 0x95 0x84
# CHECK: r17:16 = convert_sf2d(r21)
0xb0 0xc0 0x95 0x84
# CHECK: r17:16 = convert_sf2ud(r21):chop
0xd0 0xc0 0x95 0x84
# CHECK: r17:16 = convert_sf2d(r21):chop
0x31 0xc0 0x74 0x88
# CHECK: r17 = convert_df2uw(r21:20)
0x31 0xc0 0x94 0x88
# CHECK: r17 = convert_df2w(r21:20)
0x31 0xc0 0xb4 0x88
# CHECK: r17 = convert_df2uw(r21:20):chop
0x31 0xc0 0xf4 0x88
# CHECK: r17 = convert_df2w(r21:20):chop
0x11 0xc0 0x75 0x8b
# CHECK: r17 = convert_sf2uw(r21)
0x31 0xc0 0x75 0x8b
# CHECK: r17 = convert_sf2uw(r21):chop
0x11 0xc0 0x95 0x8b
# CHECK: r17 = convert_sf2w(r21)
0x31 0xc0 0x95 0x8b
# CHECK: r17 = convert_sf2w(r21):chop

# Floating point extreme value assistance
0x11 0xc0 0xb5 0x8b
# CHECK: r17 = sffixupr(r21)
0x11 0xdf 0xd5 0xeb
# CHECK: r17 = sffixupn(r21,r31)
0x31 0xdf 0xd5 0xeb
# CHECK: r17 = sffixupd(r21,r31)

# Floating point fused multiply-add
0x91 0xdf 0x15 0xef
# CHECK: r17 += sfmpy(r21,r31)
0xb1 0xdf 0x15 0xef
# CHECK: r17 -= sfmpy(r21,r31)

# Floating point fused multiply-add with scaling
0xf1 0xdf 0x75 0xef
# CHECK: r17 += sfmpy(r21,r31,p3):scale

# Floating point reciprocal square root approximation
0x71 0xc0 0xf5 0x8b
# CHECK: r17,p3 = sfinvsqrta(r21)

# Floating point fused multiply-add for library routines
0xd1 0xdf 0x15 0xef
# CHECK: r17 += sfmpy(r21,r31):lib
0xf1 0xdf 0x15 0xef
# CHECK: r17 -= sfmpy(r21,r31):lib

# Create floating-point constant
0xb1 0xc2 0x00 0xd6
# CHECK: r17 = sfmake(#21):pos
0xb1 0xc2 0x40 0xd6
# CHECK: r17 = sfmake(#21):neg
0xb0 0xc2 0x00 0xd9
# CHECK: r17:16 = dfmake(#21):pos
0xb0 0xc2 0x40 0xd9
# CHECK: r17:16 = dfmake(#21):neg

# Floating point maximum
0x11 0xdf 0x95 0xeb
# CHECK: r17 = sfmax(r21,r31)

# Floating point minimum
0x31 0xdf 0x95 0xeb
# CHECK: r17 = sfmin(r21,r31)

# Floating point multiply
0x11 0xdf 0x55 0xeb
# CHECK: r17 = sfmpy(r21,r31)

# Floating point reciprocal approximation
0xf1 0xdf 0xf5 0xeb
# CHECK: r17,p3 = sfrecipa(r21,r31)

# Floating point subtraction
0x31 0xdf 0x15 0xeb
# CHECK: r17 = sfsub(r21,r31)
