2018-06-14 02:45:25 +08:00
|
|
|
# REQUIRES: hexagon
|
2019-09-17 10:45:38 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon.s -o %t1.o
|
|
|
|
# RUN: ld.lld %t.o %t1.o -o %t
|
|
|
|
# RUN: llvm-objdump -d %t | FileCheck %s
|
2018-06-14 02:45:25 +08:00
|
|
|
|
2019-09-17 10:45:38 +08:00
|
|
|
# Note: 131648 == 0x20240
|
2018-07-29 19:59:38 +08:00
|
|
|
# R_HEX_32_6_X
|
|
|
|
# R_HEX_12_X
|
|
|
|
if (p0) r0 = ##_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: immext(#131648)
|
|
|
|
# CHECK: if (p0) r0 = ##131648
|
2018-07-29 19:59:38 +08:00
|
|
|
|
2018-07-20 04:27:43 +08:00
|
|
|
# R_HEX_B15_PCREL
|
|
|
|
if (p0) jump:nt #_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: if (p0) jump:nt 0x20240
|
2018-07-20 04:27:43 +08:00
|
|
|
|
2018-07-24 23:08:13 +08:00
|
|
|
# R_HEX_B32_PCREL_X
|
|
|
|
# R_HEX_B15_PCREL_X
|
|
|
|
if (p0) jump:nt ##_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: if (p0) jump:nt 0x20240
|
2018-07-24 23:08:13 +08:00
|
|
|
|
2018-06-14 02:45:25 +08:00
|
|
|
# R_HEX_B22_PCREL
|
|
|
|
call #_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: call 0x20240
|
2018-07-20 03:10:56 +08:00
|
|
|
|
|
|
|
# R_HEX_B32_PCREL_X
|
|
|
|
# R_HEX_B22_PCREL_X
|
|
|
|
call ##_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: immext(#320)
|
|
|
|
# CHECK: call 0x20240
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
# R_HEX_6_X tests:
|
|
|
|
# One test for each mask in the lookup table.
|
|
|
|
|
|
|
|
#0x38000000
|
|
|
|
if (!P0) memw(r0+#8)=##_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 38c0c100 if (!p0) memw(r0+#8) = ##131648 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x39000000
|
|
|
|
{ p0 = p1
|
|
|
|
if (!P0.new) memw(r0+#0)=##_start }
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 39c0c000 if (!p0.new) memw(r0+#0) = ##131648 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x3e000000
|
|
|
|
memw(r0+##_start)+=r1
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 3e40c001 memw(r0+##131648) += r1 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x3f000000
|
|
|
|
memw(r0+##_start)+=#4
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 3f40c004 memw(r0+##131648) += #4 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x40000000
|
|
|
|
{ r0 = r1
|
|
|
|
if (p0) memb(r0+##_start)=r0.new }
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 40a0c200 if (p0) memb(r0+##131648) = r0.new }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x41000000
|
|
|
|
if (p0) r0=memb(r1+##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4101c000 if (p0) r0 = memb(r1+##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x42000000
|
|
|
|
{ r0 = r1
|
|
|
|
p0 = p1
|
|
|
|
if (p0.new) memb(r0+##_start)=r0.new }
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 42a0c200 if (p0.new) memb(r0+##131648) = r0.new }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x43000000
|
|
|
|
{ p0 = p1
|
|
|
|
if (P0.new) r0=memb(r0+##_start) }
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4300c000 if (p0.new) r0 = memb(r0+##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x44000000
|
|
|
|
if (!p0) memb(r0+##_start)=r1
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4400c100 if (!p0) memb(r0+##131648) = r1 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x45000000
|
|
|
|
if (!p0) r0=memb(r1+##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4501c000 if (!p0) r0 = memb(r1+##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x46000000
|
|
|
|
{ p0 = p1
|
|
|
|
if (!p0.new) memb(r0+##_start)=r1 }
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4600c100 if (!p0.new) memb(r0+##131648) = r1 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x47000000
|
|
|
|
{ p0 = p1
|
|
|
|
if (!p0.new) r0=memb(r1+##_start) }
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4701c000 if (!p0.new) r0 = memb(r1+##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x6a000000 -- Note 4294967132 == -0xa4 the distance between
|
|
|
|
# here and _start, so this will change if
|
|
|
|
# tests are added between here and _start
|
|
|
|
r0=add(pc,##_start@pcrel)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 6a49d800 r0 = add(pc,##240) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x7c000000
|
|
|
|
r1:0=combine(#8,##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 7c80c100 r1:0 = combine(#8,##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x9a000000
|
|
|
|
r1:0=memb_fifo(r2=##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 9a82d000 r1:0 = memb_fifo(r2=##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x9b000000
|
|
|
|
r0=memb(r1=##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 9b01d000 r0 = memb(r1=##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x9c000000
|
|
|
|
r1:0=memb_fifo(r2<<#2+##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 9c82f000 r1:0 = memb_fifo(r2<<#2+##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x9d000000
|
|
|
|
r0=memb(r1<<#2+##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 9d01f000 r0 = memb(r1<<#2+##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0x9f000000
|
|
|
|
if (!p0) r0=memb(##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 9f00e880 if (!p0) r0 = memb(##131648) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0xab000000
|
|
|
|
memb(r0=##_start)=r1
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: ab00c180 memb(r0=##131648) = r1 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0xad000000
|
|
|
|
memb(r0<<#2+##_start)=r1
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: ad00e180 memb(r0<<#2+##131648) = r1 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0xaf000000
|
|
|
|
if (!p0) memb(##_start)=r1
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: af00c184 if (!p0) memb(##131648) = r1 }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0xd7000000
|
|
|
|
r0=add(##_start,mpyi(r1,r2))
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: d701c200 r0 = add(##131648,mpyi(r1,r2)) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0xd8000000
|
|
|
|
R0=add(##_start,mpyi(r0,#2))
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: d800c002 r0 = add(##131648,mpyi(r0,#2)) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0xdb000000
|
|
|
|
r0=add(r1,add(r2,##_start))
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: db01c002 r0 = add(r1,add(r2,##131648)) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
#0xdf000000
|
|
|
|
r0=add(r1,mpyi(r2,##_start))
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: df82c001 r0 = add(r1,mpyi(r2,##131648)) }
|
2018-08-09 20:00:10 +08:00
|
|
|
|
|
|
|
# Duplex form of R_HEX_6_X
|
|
|
|
# R_HEX_32_6_X
|
|
|
|
# R_HEX_6_X
|
|
|
|
{ r0 = ##_start; r2 = r16 }
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 28003082 r0 = ##131648; r2 = r16 }
|
2018-08-10 04:04:53 +08:00
|
|
|
|
|
|
|
# R_HEX_HI16
|
|
|
|
r0.h = #HI(_start)
|
2018-09-21 00:32:19 +08:00
|
|
|
# CHECK: r0.h = #2
|
2018-08-10 04:04:53 +08:00
|
|
|
|
|
|
|
# R_HEX_LO16
|
|
|
|
r0.l = #LO(_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: r0.l = #576
|
2018-08-11 05:48:40 +08:00
|
|
|
|
|
|
|
# R_HEX_8_X has 3 relocation mask variations
|
|
|
|
#0xde000000
|
2018-08-11 07:46:11 +08:00
|
|
|
r0=sub(##_start, asl(r0, #1))
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: de40c106 r0 = sub(##131648,asl(r0,#1)) }
|
2018-08-11 05:48:40 +08:00
|
|
|
|
|
|
|
#0x3c000000
|
|
|
|
memw(r0+#0) = ##_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 3c40c040 memw(r0+#0) = ##131648 }
|
2018-08-11 05:48:40 +08:00
|
|
|
|
|
|
|
# The rest:
|
|
|
|
r1:0=combine(r2,##_start);
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 7302e800 r1:0 = combine(r2,##131648) }
|
2018-08-14 21:52:38 +08:00
|
|
|
|
|
|
|
# R_HEX_32:
|
|
|
|
r_hex_32:
|
|
|
|
.word _start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 00020240
|
2018-08-22 23:25:15 +08:00
|
|
|
|
|
|
|
# R_HEX_16_X has 4 relocation mask variations
|
|
|
|
# 0x48000000
|
|
|
|
memw(##_start) = r0
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4880c000 memw(##131648) = r0 }
|
2018-08-22 23:25:15 +08:00
|
|
|
|
|
|
|
# 0x49000000
|
|
|
|
r0 = memw(##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 4980c000 r0 = memw(##131648)
|
2018-08-22 23:25:15 +08:00
|
|
|
|
|
|
|
# 0x78000000
|
|
|
|
r0 = ##_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: 7800c000 r0 = ##131648 }
|
2018-08-22 23:25:15 +08:00
|
|
|
|
|
|
|
# 0xb0000000
|
|
|
|
r0 = add(r1, ##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: b001c000 r0 = add(r1,##131648) }
|
2018-08-26 05:25:35 +08:00
|
|
|
|
|
|
|
# R_HEX_B9_PCREL:
|
|
|
|
{r0=#1 ; jump #_start}
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: jump 0x20240
|
2018-08-26 05:25:35 +08:00
|
|
|
|
|
|
|
# R_HEX_B9_PCREL_X:
|
|
|
|
{r0=#1 ; jump ##_start}
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: jump 0x20240
|
2018-08-26 07:16:37 +08:00
|
|
|
|
|
|
|
# R_HEX_B13_PCREL
|
|
|
|
if (r0 == #0) jump:t #_start
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: if (r0==#0) jump:t 0x20240
|
2018-08-27 20:55:28 +08:00
|
|
|
|
|
|
|
# R_HEX_9_X
|
|
|
|
p0 = !cmp.gtu(r0, ##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: p0 = !cmp.gtu(r0,##131648)
|
2018-08-27 20:55:28 +08:00
|
|
|
|
|
|
|
# R_HEX_10_X
|
|
|
|
p0 = !cmp.gt(r0, ##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: p0 = !cmp.gt(r0,##131648)
|
2018-08-27 20:55:28 +08:00
|
|
|
|
|
|
|
# R_HEX_11_X
|
|
|
|
r0 = memw(r1+##_start)
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: r0 = memw(r1+##131648)
|
2018-08-27 20:55:28 +08:00
|
|
|
|
|
|
|
memw(r0+##_start) = r1
|
2019-09-17 10:45:38 +08:00
|
|
|
# CHECK: memw(r0+##131648) = r1
|