Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The only way I could ticke this with a small program was to write it directly in .cmm (urgh).
- Loading branch information
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{-# LANGUAGE MagicHash,GHCForeignImportPrim,UnliftedFFITypes #-} | ||
module Main where | ||
|
||
import GHC.Exts | ||
|
||
foreign import prim "f5149" f :: Int# -> Int# -> Double# -> Int# | ||
|
||
main = print (I# (f 1# 2# 1.0##)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "Cmm.h" | ||
|
||
/* This code is carefully arranged to tickle the bug reported in #5149 */ | ||
f5149 | ||
{ | ||
D_ z; | ||
|
||
z = D1; | ||
|
||
W_ x,y; | ||
x = R1; | ||
y = R2; | ||
|
||
if (x > y) { | ||
goto a; /* this jump is shortcutted to g5149 */ | ||
} else { | ||
goto b; | ||
} | ||
|
||
a: | ||
jump g5149; | ||
b: | ||
RET_N(TO_W_(%f2i32(z))); | ||
} | ||
|
||
g5149 | ||
{ | ||
jump %ENTRY_CODE(Sp(0)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
TOP=../../../.. | ||
include $(TOP)/mk/boilerplate.mk | ||
include $(TOP)/mk/test.mk | ||
|
||
.PHONY: 5149 | ||
5149: | ||
$(RM) 5149_cmm.o 5149.o 5149.hi 5149$(exeext) | ||
$(TEST_HC) -v0 -O -c 5149_cmm.cmm | ||
$(TEST_HC) -v0 --make -O 5149.hs 5149_cmm.o -o 5149$(exeext) | ||
./5149 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters