[LLVMbugs] [Bug 5053] New: incorrect 'frem' behaviour with floats

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Sep 25 12:10:30 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=5053

           Summary: incorrect 'frem' behaviour with floats
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: eugeny.grishul at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Use following test case:

target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i686-pc-win32"

@flt = internal global float 12.0e+0
@str = internal constant [18 x i8] c"Double value:%f \0A\00"

declare i32 @printf(i8* nocapture, ...) nounwind

define void @main() {
  %flt = load float* @flt
  %float2 = frem float %flt, 5.0
  %double1 = fpext float %float2 to double
  %yo = call i32(i8* nocapture, ...)* @printf( i8* getelementptr ([18 x i8]*
@str, i32 0, i64 0), double %double1 )

  ret void
}

Running with JIT:
Stack dump:
0.      Program arguments: lli test.bc
00000000 (0x41400000 0x40A00000 0x00FEFA40 0x0008D3B1) <unknown module>
00FF003B (0x01A1F6B4 0x01BFB4B0 0x01A1F784 0x5C1E1B36) <unknown module>
0033EA9C (0x01BFB4B0 0x00D81B5C 0x00FE1D20 0x5C1E15EA),
llvm::ExecutionEngine::runFunctionAsMain()+0940 bytes(s),
e:\external\llvm\lib\executionengine\executionengine.cpp, line 387+0030 byte(s)
00081894 (0x00000002 0x00FE7FD8 0x00FE1D20 0x5C1E155A), main()+2196 bytes(s),
e:\external\llvm\tools\lli\lli.cpp, line 218+0064 byte(s)
00A6BFB8 (0x01A1F9D4 0x776F3677 0x7EFDE000 0x01A1FA14),
__tmainCRTStartup()+0424 bytes(s),
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c, line 586+0025 byte(s)
00A6BDEF (0x7EFDE000 0x01A1FA14 0x77C99D72 0x7EFDE000), mainCRTStartup()+0015
bytes(s), f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c, line 403
776F3677 (0x7EFDE000 0x7623FA65 0x00000000 0x00000000),
BaseThreadInitThunk()+0018 bytes(s)
77C99D72 (0x00A6BDE0 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeExceptionChain()+0099 bytes(s)
77C99D45 (0x00A6BDE0 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeExceptionChain()+0054 bytes(s)

Running with interpreter:
Double value:2.000000

But if I change floats to doubles - all is OK:

target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i686-pc-win32"

@flt = internal global double 12.0e+0
@str = internal constant [18 x i8] c"Double value:%f \0A\00"

declare i32 @printf(i8* nocapture, ...) nounwind

define void @main() {
  %flt = load double* @flt
  %float2 = frem double %flt, 5.0
  %yo = call i32(i8* nocapture, ...)* @printf( i8* getelementptr ([18 x i8]*
@str, i32 0, i64 0), double %float2 )

  ret void
}


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list