diff options
author | Bob Wilson <bob.wilson@apple.com> | 2014-11-12 23:01:24 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2014-11-12 23:01:24 +0000 |
commit | ec9a8c8b10f85a07037b2c7fc3d66d5fbd75c3d5 (patch) | |
tree | 9fb0488ed391769d49d7d1de652a9334f060d586 | |
parent | 04348de5d397f03347f45280be2810d6f4ba4815 (diff) | |
download | bcm5719-llvm-ec9a8c8b10f85a07037b2c7fc3d66d5fbd75c3d5.tar.gz bcm5719-llvm-ec9a8c8b10f85a07037b2c7fc3d66d5fbd75c3d5.zip |
PR21518: Use unsigned arithmetic for trapping add/sub functions.
The code in {add,sub}v.i3 routines does not trap when it should, because
it performs the actual add/subtract operation in signed arithmetic,
rather than unsigned.
Patch by Francois-Xavie Coudert!
llvm-svn: 221826
-rw-r--r-- | compiler-rt/lib/builtins/addvdi3.c | 2 | ||||
-rw-r--r-- | compiler-rt/lib/builtins/addvsi3.c | 2 | ||||
-rw-r--r-- | compiler-rt/lib/builtins/addvti3.c | 2 | ||||
-rw-r--r-- | compiler-rt/lib/builtins/subvdi3.c | 2 | ||||
-rw-r--r-- | compiler-rt/lib/builtins/subvsi3.c | 2 | ||||
-rw-r--r-- | compiler-rt/lib/builtins/subvti3.c | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/compiler-rt/lib/builtins/addvdi3.c b/compiler-rt/lib/builtins/addvdi3.c index db45a27f078..0da38945679 100644 --- a/compiler-rt/lib/builtins/addvdi3.c +++ b/compiler-rt/lib/builtins/addvdi3.c @@ -21,7 +21,7 @@ COMPILER_RT_ABI di_int __addvdi3(di_int a, di_int b) { - di_int s = a + b; + di_int s = (du_int) a + (du_int) b; if (b >= 0) { if (s < a) diff --git a/compiler-rt/lib/builtins/addvsi3.c b/compiler-rt/lib/builtins/addvsi3.c index 81f515cd7bb..94ca726f42b 100644 --- a/compiler-rt/lib/builtins/addvsi3.c +++ b/compiler-rt/lib/builtins/addvsi3.c @@ -21,7 +21,7 @@ COMPILER_RT_ABI si_int __addvsi3(si_int a, si_int b) { - si_int s = a + b; + si_int s = (su_int) a + (su_int) b; if (b >= 0) { if (s < a) diff --git a/compiler-rt/lib/builtins/addvti3.c b/compiler-rt/lib/builtins/addvti3.c index 79b9611f98c..c224de60aab 100644 --- a/compiler-rt/lib/builtins/addvti3.c +++ b/compiler-rt/lib/builtins/addvti3.c @@ -23,7 +23,7 @@ COMPILER_RT_ABI ti_int __addvti3(ti_int a, ti_int b) { - ti_int s = a + b; + ti_int s = (tu_int) a + (tu_int) b; if (b >= 0) { if (s < a) diff --git a/compiler-rt/lib/builtins/subvdi3.c b/compiler-rt/lib/builtins/subvdi3.c index 0f1f924effc..71fc70ffa92 100644 --- a/compiler-rt/lib/builtins/subvdi3.c +++ b/compiler-rt/lib/builtins/subvdi3.c @@ -21,7 +21,7 @@ COMPILER_RT_ABI di_int __subvdi3(di_int a, di_int b) { - di_int s = a - b; + di_int s = (du_int) a - (du_int) b; if (b >= 0) { if (s > a) diff --git a/compiler-rt/lib/builtins/subvsi3.c b/compiler-rt/lib/builtins/subvsi3.c index ec4594c9f0e..e6c0fb688c9 100644 --- a/compiler-rt/lib/builtins/subvsi3.c +++ b/compiler-rt/lib/builtins/subvsi3.c @@ -21,7 +21,7 @@ COMPILER_RT_ABI si_int __subvsi3(si_int a, si_int b) { - si_int s = a - b; + si_int s = (su_int) a - (su_int) b; if (b >= 0) { if (s > a) diff --git a/compiler-rt/lib/builtins/subvti3.c b/compiler-rt/lib/builtins/subvti3.c index 8f1171430e1..a6804d2d7b9 100644 --- a/compiler-rt/lib/builtins/subvti3.c +++ b/compiler-rt/lib/builtins/subvti3.c @@ -23,7 +23,7 @@ COMPILER_RT_ABI ti_int __subvti3(ti_int a, ti_int b) { - ti_int s = a - b; + ti_int s = (tu_int) a - (tu_int) b; if (b >= 0) { if (s > a) |