Fangrui Song c5037db4ac [BPF,test] Change llc -march= to -mtriple=
Similar to 806761a7629df268c8aed49657aeccffa6bca449

-mtriple= specifies the full target triple while -march= merely sets the
architecture part of the default target triple (e.g. Windows, macOS),
leaving a target triple which may not make sense.

Therefore, -march= is error-prone and not recommended for tests without
a target triple. The issue has been benign as we recognize
bpf*-apple-darwin as ELF instead of rejecting it outrightly.
2024-12-15 11:04:24 -08:00

44 lines
897 B
LLVM

; RUN: llc < %s -mtriple=bpfel -mcpu=v1 | FileCheck %s
define i16 @am1(ptr %a) nounwind {
%1 = load i16, ptr %a
ret i16 %1
}
; CHECK-LABEL: am1:
; CHECK: r0 = *(u16 *)(r1 + 0)
@foo = external global i16
define i16 @am2() nounwind {
%1 = load i16, ptr @foo
ret i16 %1
}
; CHECK-LABEL: am2:
; CHECK: r0 = *(u16 *)(r1 + 0)
define i16 @am4() nounwind {
%1 = load volatile i16, ptr inttoptr(i16 32 to ptr)
ret i16 %1
}
; CHECK-LABEL: am4:
; CHECK: r1 = 32
; CHECK: r0 = *(u16 *)(r1 + 0)
define i16 @am5(ptr %a) nounwind {
%1 = getelementptr i16, ptr %a, i16 2
%2 = load i16, ptr %1
ret i16 %2
}
; CHECK-LABEL: am5:
; CHECK: r0 = *(u16 *)(r1 + 4)
%S = type { i16, i16 }
@baz = common global %S zeroinitializer, align 1
define i16 @am6() nounwind {
%1 = load i16, ptr getelementptr (%S, ptr @baz, i32 0, i32 1)
ret i16 %1
}
; CHECK-LABEL: am6:
; CHECK: r0 = *(u16 *)(r1 + 2)