diff options
| author | sewardj <unknown> | 2001-12-19 17:07:49 +0000 |
|---|---|---|
| committer | sewardj <unknown> | 2001-12-19 17:07:49 +0000 |
| commit | 32e08a78a4a8932369bafb9f36081a4a3a794a57 (patch) | |
| tree | 10510593c1ca3fcf5f140adcb589adc514d4afc9 | |
| parent | e01afc7ed018e28dbb0e9447714e630acbd0a9cc (diff) | |
| download | haskell-32e08a78a4a8932369bafb9f36081a4a3a794a57.tar.gz | |
[project @ 2001-12-19 17:07:49 by sewardj]
Correctly handle signed vs unsigned integer division on x86.
| -rw-r--r-- | ghc/compiler/nativeGen/PprMach.lhs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ghc/compiler/nativeGen/PprMach.lhs b/ghc/compiler/nativeGen/PprMach.lhs index 0e3ae2999a..13b175911d 100644 --- a/ghc/compiler/nativeGen/PprMach.lhs +++ b/ghc/compiler/nativeGen/PprMach.lhs @@ -1133,12 +1133,14 @@ pprInstr_quotRem signed isQuot sz src dst = vcat [ (text "\t# BEGIN " <> fakeInsn), (text "\tpushl $0; pushl %eax; pushl %edx; pushl " <> pprOperand sz src), - (text "\tmovl " <> pprOperand sz dst <> text ",%eax; xorl %edx,%edx; cltd"), + (text "\tmovl " <> pprOperand sz dst <> text ",%eax; " <> widen_to_64), (x86op <> text " 0(%esp); movl " <> text resReg <> text ",12(%esp)"), (text "\tpopl %edx; popl %edx; popl %eax; popl " <> pprOperand sz dst), (text "\t# END " <> fakeInsn) ] where + widen_to_64 | signed = text "cltd" + | not signed = text "xorl %edx,%edx" x86op = if signed then text "\tidivl" else text "\tdivl" resReg = if isQuot then "%eax" else "%edx" opStr | signed = if isQuot then "IQUOT" else "IREM" |
