// RUN: llvm-tblgen -gen-runtime-libcalls -I %p/../../include %s 2> %t.err | FileCheck %s // RUN: FileCheck -check-prefix=ERR %s < %t.err // Check behavior of libcall emission when multiple RuntimeLibcallImpl // implementations provide the same RuntimeLibcall include "llvm/IR/RuntimeLibcallsImpl.td" def SOME_FUNC : RuntimeLibcall; def OTHER_FUNC : RuntimeLibcall; def ANOTHER_DUP : RuntimeLibcall; def isTargetArchA : RuntimeLibcallPredicate<[{isTargetArchA()}]>; def isTargetArchB : RuntimeLibcallPredicate<[{isTargetArchB()}]>; def isTargetArchC : RuntimeLibcallPredicate<[{isTargetArchC()}]>; def func_a : RuntimeLibcallImpl; def func_b : RuntimeLibcallImpl; def func_c : RuntimeLibcallImpl; def other_func : RuntimeLibcallImpl; def dup0 : RuntimeLibcallImpl; def dup1 : RuntimeLibcallImpl; // func_a and func_b both provide SOME_FUNC. // CHECK: if (isTargetArchA()) { // CHECK-NEXT: static constexpr LibcallImplBitset SystemAvailableImpls({ // CHECK-NEXT: 0x00000000000018 // CHECK-NEXT: }); // CHECK-NEXT: AvailableLibcallImpls = SystemAvailableImpls; // CHECK-EMPTY: // CHECK-NEXT: static const RTLIB::LibcallImpl LibraryCalls[] = { // CHECK-NEXT: RTLIB::impl_func_b, // func_b // CHECK-NEXT: }; // CHECK-EMPTY: // CHECK-NEXT: for (const RTLIB::LibcallImpl Impl : LibraryCalls) { // CHECK-NEXT: setAvailable(Impl); // CHECK-NEXT: } // CHECK-EMPTY: // CHECK-NEXT: return; // CHECK-NEXT: } // ERR: :[[@LINE+1]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_b, func_a def TheSystemLibraryA : SystemRuntimeLibrary; // CHECK: if (isTargetArchB()) { // CHECK-NEXT: static constexpr LibcallImplBitset SystemAvailableImpls({ // CHECK-NEXT: 0x00000000000058 // CHECK-NEXT: }); // CHECK-NEXT: AvailableLibcallImpls = SystemAvailableImpls; // CHECK-EMPTY: // CHECK-NEXT: static const RTLIB::LibcallImpl LibraryCalls[] = { // CHECK-NEXT: RTLIB::impl_other_func, // other_func // CHECK-NEXT: RTLIB::impl_func_a, // func_a // CHECK-NEXT: }; // CHECK-EMPTY: // CHECK-NEXT: for (const RTLIB::LibcallImpl Impl : LibraryCalls) { // CHECK-NEXT: setAvailable(Impl); // CHECK-NEXT: } // CHECK-EMPTY: // CHECK-NEXT: return; // CHECK-NEXT: } // ERR: :[[@LINE+1]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_a, func_b def TheSystemLibraryB : SystemRuntimeLibrary; // CHECK: if (isTargetArchC()) { // CHECK-NEXT: static constexpr LibcallImplBitset SystemAvailableImpls({ // CHECK-NEXT: 0x0000000000007e // CHECK-NEXT: }); // CHECK-NEXT: AvailableLibcallImpls = SystemAvailableImpls; // CHECK-EMPTY: // CHECK-NEXT: static const RTLIB::LibcallImpl LibraryCalls[] = { // CHECK-NEXT: RTLIB::impl_dup1, // dup1 // CHECK-NEXT: RTLIB::impl_other_func, // other_func // CHECK-NEXT: RTLIB::impl_func_a, // func_a // CHECK-NEXT: }; // CHECK-EMPTY: // CHECK-NEXT: for (const RTLIB::LibcallImpl Impl : LibraryCalls) { // CHECK-NEXT: setAvailable(Impl); // CHECK-NEXT: } // CHECK-EMPTY: // CHECK-NEXT: return; // CHECK-NEXT: } // ERR: :[[@LINE+3]]:5: warning: conflicting implementations for libcall ANOTHER_DUP: dup1, dup0 // ERR: :[[@LINE+2]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_a, func_b // ERR: :[[@LINE+1]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_a, func_c def TheSystemLibraryC : SystemRuntimeLibrary;