Skip to content

Commit

Permalink
FIX: [ARM] runtime floats double type casting issue fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
dockimbel committed Mar 12, 2012
1 parent c73af21 commit 5dbfbb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 5 additions & 2 deletions red-system/compiler.r
Original file line number Diff line number Diff line change
Expand Up @@ -2001,8 +2001,11 @@ system-dialect: context [

if ret: select spec return-def [
check-expected-type/ret name expr ret ;-- validate return value type
if all [object? expr not literal? expr/data][
emitter/target/emit-casting expr no ;-- insert runtime type casting if required
if all [
object? expr
find [block! tag!] type?/word expr/data
][
emitter/target/emit-casting expr no ;-- insert runtime type casting when required
last-type: expr/type
]
]
Expand Down
11 changes: 4 additions & 7 deletions red-system/targets/ARM.r
Original file line number Diff line number Diff line change
Expand Up @@ -1340,10 +1340,7 @@ make target-class [
emit-push <last>
]
object! [
unless any [
path? value/data
compiler/any-float? compiler/get-type value/data
][
unless path? value/data [
emit-casting value no
]
either cdecl [
Expand Down Expand Up @@ -1670,6 +1667,7 @@ make target-class [
left: compiler/unbox args/1
right: compiler/unbox args/2
set-width args/1
saved: width

switch a [ ;-- load left operand in d0 or s0
imm [
Expand All @@ -1683,6 +1681,7 @@ make target-class [
]
]
ref [
set-width left
either width = 8 [
emit-float-variable args/1
#{ed930b00} ;-- FLDD d0, [r3] ; global
Expand Down Expand Up @@ -1721,8 +1720,6 @@ make target-class [
]
]

saved: width

switch b [ ;-- load right operand in d1 or s2
imm [
set-width args/2
Expand Down Expand Up @@ -1771,7 +1768,7 @@ make target-class [
emit-float ;-- load immediate from data segment
#{eeb40b41} ;-- FCMPD d0, d1
#{eeb40a41} ;-- FCMPS s0, s2
emit-i32 #{eef1fa10} ;-- FMSTAT ; transfer flags to CPU
emit-i32 #{eef1fa10} ;-- FMSTAT ; transfer flags to CPU
]
find math-op name [
either width = 8 [
Expand Down

0 comments on commit 5dbfbb4

Please sign in to comment.