[cfe-commits] [PATCH] Change cmp_XY x86/AVX builtin definition from static inline to macro in avxintrin.h
Syoyo Fujita
syoyofujita at gmail.com
Thu Apr 7 00:42:20 PDT 2011
>> Is there any good way to write a such host-dependent test in clang
>> test-framework?
>> I'm ready to write a test if a guideline is provided.
>
> Eli suggested looking at test/CodeGen/mmx_builtins.c, which does
> similar sorts of things.
mmx-builtins.c tests asm output, but in my patch I'd like to test LLVM
IR outout.
Thus I created a test by referencing test/CodeGen/vector.c .
Also, llc with +avx feature failed to compile a test(based on
mmx-builtin.c) in current llvm trunk, so I think it'd be better to
referencing mmx-builtins.c for AVX things for a while.
-------------------------
avx-builtins.c
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx
-S -o - | FileCheck %s
#include <immintrin.h>
__m128d test88(__m128d a, __m128d b) {
// CHECK: vcmppd
return _mm_cmp_pd(a, b, _CMP_GE_OS);
}
------------------
syoyos-MacBook-Pro:test syoyo$
/Users/syoyo/work/llvm-git/Debug+Asserts/bin/clang -cc1
/Users/syoyo/work/llvm-git/tools/clang/test/CodeGen/avx-builtins.c
-triple=x86_64-apple-darwin -target-feature +avx -S
Assertion failed: (0 && "Invalid ssecc argument!"), function
printSSECC, file X86ATTInstPrinter.cpp, line 46.
0 clang 0x000000010139c89a PrintStackTrace(void*) + 38
1 clang 0x000000010139ce55 SignalHandler(int) + 254
2 libSystem.B.dylib 0x00007fff8070766a _sigtramp + 26
3 libSystem.B.dylib 000000000000000000 _sigtramp + 2140113328
4 clang 0x000000010139c7d7 raise + 27
5 clang 0x000000010139c7e7 abort + 14
6 clang 0x000000010139c874 PrintStackTrace(void*) + 0
7 clang 0x00000001011e7a2b
llvm::X86ATTInstPrinter::printSSECC(llvm::MCInst const*, unsigned int,
llvm::raw_ostream&) + 157
8 clang 0x00000001011e81b4
llvm::X86ATTInstPrinter::printInstruction(llvm::MCInst const*,
llvm::raw_ostream&) + 1620
9 clang 0x00000001011eda67
llvm::X86ATTInstPrinter::printInst(llvm::MCInst const*,
llvm::raw_ostream&) + 37
10 clang 0x0000000101321f72 (anonymous
namespace)::MCAsmStreamer::EmitInstruction(llvm::MCInst const&) + 392
11 clang 0x0000000100c8806e
llvm::X86AsmPrinter::EmitInstruction(llvm::MachineInstr const*) + 1910
12 clang 0x0000000100e233e2
llvm::AsmPrinter::EmitFunctionBody() + 1070
13 clang 0x0000000100bd7835
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) +
299
14 clang 0x0000000100f07821
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 85
15 clang 0x00000001012d13f9
llvm::FPPassManager::runOnFunction(llvm::Function&) + 385
16 clang 0x00000001012d15ef
llvm::FPPassManager::runOnModule(llvm::Module&) + 81
17 clang 0x00000001012d10a6
llvm::MPPassManager::runOnModule(llvm::Module&) + 384
18 clang 0x00000001012d28a2
llvm::PassManagerImpl::run(llvm::Module&) + 116
19 clang 0x00000001012d2903
llvm::PassManager::run(llvm::Module&) + 33
20 clang 0x0000000100170c71 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_ostream*) + 753
21 clang 0x0000000100170d25
clang::EmitBackendOutput(clang::Diagnostic&, clang::CodeGenOptions
const&, clang::TargetOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 115
22 clang 0x0000000100260d1c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) +
436
23 clang 0x000000010028c8e2 clang::ParseAST(clang::Sema&,
bool) + 547
24 clang 0x0000000100065b6f
clang::ASTFrontendAction::ExecuteAction() + 233
25 clang 0x000000010025f82b
clang::CodeGenAction::ExecuteAction() + 793
26 clang 0x0000000100065c7c clang::FrontendAction::Execute() + 262
27 clang 0x000000010004ee0c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 710
28 clang 0x000000010000d269
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 787
29 clang 0x0000000100001bc8 cc1_main(char const**, char
const**, char const*, void*) + 897
30 clang 0x0000000100009d74 main + 450
31 clang 0x0000000100001334 start + 52
Stack dump:
0. Program arguments:
/Users/syoyo/work/llvm-git/Debug+Asserts/bin/clang -cc1
/Users/syoyo/work/llvm-git/tools/clang/test/CodeGen/avx-builtins.c
-triple=x86_64-apple-darwin -target-feature +avx -S
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module
'/Users/syoyo/work/llvm-git/tools/clang/test/CodeGen/avx-builtins.c'.
4. Running pass 'X86 AT&T-Style Assembly Printer' on function '@test88'
Illegal instruction
More information about the cfe-commits
mailing list