File tree Expand file tree Collapse file tree 3 files changed +41
-40
lines changed Expand file tree Collapse file tree 3 files changed +41
-40
lines changed Original file line number Diff line number Diff line change @@ -2808,13 +2808,30 @@ def WasmSystemLibrary
28082808 emscripten_return_address,
28092809 __stack_chk_fail, __stack_chk_guard)>;
28102810
2811+ //===----------------------------------------------------------------------===//
2812+ // BPF Runtime Libcalls
2813+ //===----------------------------------------------------------------------===//
2814+
2815+ def isBPF : RuntimeLibcallPredicate<"TT.isBPF()">;
2816+
2817+ def BPFSystemLibrary
2818+ : SystemRuntimeLibrary<isBPF,
2819+ (add (sub DefaultRuntimeLibcallImpls,
2820+ // i128 operations should be lowered by LLVM for BPF
2821+ __divti3,
2822+ __udivti3,
2823+ __modti3,
2824+ __umodti3,
2825+ __clzti2
2826+ ))>;
2827+
28112828//===----------------------------------------------------------------------===//
28122829// Legacy Default Runtime Libcalls
28132830//===----------------------------------------------------------------------===//
28142831
28152832// TODO: Should make every target explicit.
28162833def isDefaultLibcallArch : RuntimeLibcallPredicate<[{
2817- TT.isMIPS() || TT.isLoongArch() || TT.isVE() || TT.isBPF() ||
2834+ TT.isMIPS() || TT.isLoongArch() || TT.isVE() ||
28182835 TT.getArch() == Triple::csky || TT.getArch() == Triple::arc ||
28192836 TT.getArch() == Triple::m68k || TT.getArch() == Triple::xtensa ||
28202837 (TT.isSystemZ() && !TT.isOSzOS())
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ ; RUN: llc -march=bpfel < %s | FileCheck %s
2+ ;
3+ ; C code for this test case:
4+ ;
5+ ; long func(long a, long b) {
6+ ; long x;
7+ ; return __builtin_mul_overflow(a, b, &x);
8+ ; }
9+
10+
11+ declare { i64 , i1 } @llvm.smul.with.overflow.i64 (i64 , i64 )
12+
13+ define noundef range(i64 0 , 2 ) i64 @func (i64 noundef %a , i64 noundef %b ) local_unnamed_addr {
14+ entry:
15+ %0 = tail call { i64 , i1 } @llvm.smul.with.overflow.i64 (i64 %a , i64 %b )
16+ %1 = extractvalue { i64 , i1 } %0 , 1
17+ %conv = zext i1 %1 to i64
18+ ret i64 %conv
19+ }
20+
21+ ; CHECK-LABEL: func
22+ ; CHECK-NOT: call __multi3
23+ ; CHECK: exit
You can’t perform that action at this time.
0 commit comments