assertion when -sse2 on x86-64

Hi,

I have an ir at the end of this email. Run it with:

llc -mcpu=i386 -march=x86-64 -mattr=-sse2

and get assertion below. Changing cpu does not help.

I am using llc from the latest svn repository.

Any suggestions to work around this? I need to disable sse2 instructions for x86-64.

Thanks,

-Peng

-----error message------

llc: X86FloatingPoint.cpp:332: unsigned int getFPReg(const llvm::MachineOperand &): Assertion `Reg >= X86::FP0 && Reg <= X86::FP6 && “Expected FP register!”’ failed.
0 llc 0x0000000000f75942 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1 llc 0x0000000000f75ed8
2 libpthread.so.0 0x00007f23f8edef60
3 libc.so.6 0x00007f23f7fe9165 gsignal + 53
4 libc.so.6 0x00007f23f7febf70 abort + 384
5 libc.so.6 0x00007f23f7fe22b1 __assert_fail + 241
6 llc 0x00000000008cf260
7 llc 0x00000000008cbb3e
8 llc 0x00000000008cb443
9 llc 0x0000000000bbfaa7 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 55
10 llc 0x0000000000f149a6 llvm::FPPassManager::runOnFunction(llvm::Function&) + 310
11 llc 0x0000000000f14c1b llvm::FPPassManager::runOnModule(llvm::Module&) + 59
12 llc 0x0000000000f14eee llvm::MPPassManager::runOnModule(llvm::Module&) + 334
13 llc 0x0000000000f15515 llvm::PassManagerImpl::run(llvm::Module&) + 293
14 llc 0x0000000000f1569a llvm::PassManager::run(llvm::Module&) + 10
15 llc 0x00000000005193e8 main + 6232
16 libc.so.6 0x00007f23f7fd5c4d __libc_start_main + 253
17 llc 0x0000000000517ac9
Stack dump:
0. Program arguments: /local/pcheng/tmp/llvm_build/bin/llc -mcpu=i386 -march=x86-64 -mattr=-sse2 test.ll -o test.bc

  1. Running pass ‘Function Pass Manager’ on module ‘test.ll’.
  2. Running pass ‘X86 FP Stackifier’ on function ‘@f3
    Abort

-------- ir ---------

; ModuleID = ‘module_name’

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind

define void @f3(double %a, [2 x double]*) {
entry:
%r1 = alloca [2 x double]
br label %1

; :1 ; preds = %entry
%2 = getelementptr [2 x double]* %r1, i64 0, i64 0
store double %a, double* %2
br label %3

; :3 ; preds = %1
%4 = getelementptr [2 x double]* %r1, i64 0, i64 1
store double %a, double* %4
br label %5

; :5 ; preds = %3
%6 = bitcast [2 x double]* %0 to i8*
%7 = bitcast [2 x double]* %r1 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %6, i8* %7, i64 16, i32 4, i1 false)
ret void
}

Attached is a patch that should fix this, but I’m not entirely sure this is the correct fix. It basically makes is so that only float will pass in xmm0 when only sse1 is enabled. Previously we would pass double in xmm0 if sse1 was enabled.

abi.patch (925 Bytes)