brintos

brintos / llvm-project-archived public Read only

0
0
Text · 973 B · 89648b1 Raw
43 lines · plain
1; RUN: llc < %s -mtriple=xcore | FileCheck %s2 3@a = external dso_local constant [0 x i32], section ".cp.rodata"4@b = external dso_local global [0 x i32]5 6define ptr @f1() nounwind {7entry:8; CHECK-LABEL: f1:9; CHECK: ldaw r11, cp[a+4]10; CHECK: mov r0, r1111	%0 = getelementptr [0 x i32], ptr @a, i32 0, i32 112	ret ptr %013}14 15define ptr @f2() nounwind {16entry:17; CHECK-LABEL: f2:18; CHECK: ldaw r0, dp[b+4]19	%0 = getelementptr [0 x i32], ptr @b, i32 0, i32 120	ret ptr %021}22 23; Don't fold negative offsets into cp / dp accesses to avoid a relocation24; error if the address + addend is less than the start of the cp / dp.25 26define ptr @f3() nounwind {27entry:28; CHECK-LABEL: f3:29; CHECK: ldaw r11, cp[a]30; CHECK: sub r0, r11, 431	%0 = getelementptr [0 x i32], ptr @a, i32 0, i32 -132	ret ptr %033}34 35define ptr @f4() nounwind {36entry:37; CHECK-LABEL: f4:38; CHECK: ldaw [[REG:r[0-9]+]], dp[b]39; CHECK: sub r0, [[REG]], 440	%0 = getelementptr [0 x i32], ptr @b, i32 0, i32 -141	ret ptr %042}43