117530Sache# Test LDR instructions with offsets misaligned by 1 byte.
217530Sache# mach(): all
317530Sache
417530Sache	.macro invalid
517530Sache# This is "undefined" but it's not properly decoded yet.
617530Sache	.word 0x07ffffff
717530Sache# This is stc which isn't recognized yet.
817530Sache	stc 0,cr0,[r0]
917530Sache	.endm
1017530Sache
1117530Sache	.global _start
1217530Sache_start:
1317530Sache# Run some simple insns to confirm the engine is at least working.
1417530Sache	nop
1517530Sache
1617530Sache# Skip over output text.
1717530Sache	bl do_test
1817530Sache
1917530Sachepass:
2017530Sache	.asciz "pass\n"
2117530Sache	.p2align 2
2217530Sache
2317530Sachedo_test:
2417530Sache	mov r4, r14
2517599Sache	bl continue
2650476Speterword1:
2717530Sache	.word 0x5555
2817530Sachecontinue:
2919129Sache	ldr r6, [r14, #1]
3019129Sache	ldr r7, word2
3117530Sache	cmp r6, r7
3219275Sache	# Failed.
3319129Sache	bne done
3419129Sache
3519129Sacheoutput_next:
3617551Sache# Output a character (in arm mode).
3718331Sache	mov r0,#3
3818331Sache	mov r1,r4
3918331Sache	swi #0x123456
4018331Sache
4118331Sache# Load next character, see if done.
4218331Sache	add r4,r4,#1
4319275Sache	sub r3,r3,r3
4417551Sache	ldrb r5,[r4,r3]
4517551Sache	teq r5,#0
4617530Sache	bne output_next
4719129Sache
4819129Sachedone:
4919129Sache	mov r0,#0x18
5019129Sache	ldr r1,exit_code
5117530Sache	swi #0x123456
5217551Sache
5317551Sache# If that fails, try to die with an invalid insn.
5417530Sache	invalid
5517530Sache
5617576Sacheexit_code:
5719129Sache	.word 0x20026
5817576Sache	.word 0xFFFFFFFF
5917576Sacheword2:
6017576Sache	.word 0x55000055
6117576Sache	.word 0xFFFFFFFF
6217576Sache