From 4c7650c3eaf4dfbe5971864bf084e76f844051ee Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 8 Jul 2016 15:44:46 +0200 Subject: Unwanted partial constant propagation in 64-bit integer arguments to builtins Here are two examples that cause an internal error in Asmexpand.ml: volatile long long x; void f(unsigned int i) { x = i; } unsigned g(unsigned i) { return __builtin_clzll(i); } The argument "i" to builtin volatile store or __builtin_clzll is turned into a BA_splitlong(BA_int 0, BA ), which Asmexpand.ml doesn't know how to handle. The fix (in AST.builtin_arg_ok) is to prevent this 'optimization' for all builtins except those of the "OK_all" kind, i.e. __builtin_annot. Regression tests were added and tested on IA32. Need to retest on ARM and PowerPC. --- test/regression/Results/builtins-powerpc | 1 + 1 file changed, 1 insertion(+) (limited to 'test/regression/Results/builtins-powerpc') diff --git a/test/regression/Results/builtins-powerpc b/test/regression/Results/builtins-powerpc index bb4edf3a..a3c63ad6 100644 --- a/test/regression/Results/builtins-powerpc +++ b/test/regression/Results/builtins-powerpc @@ -3,6 +3,7 @@ mulhwu(12345678, deadbeef) = fd5bdee clz(12345678) = 3 clzll(12345678) = 35 clzll(1234567812345678) = 3 +clzll(78563412) = 33 bswap(12345678) = 78563412 bswap16(1234) = 3412 fmadd(3.141590, 2.718000, 1.414000) = 9.952842 -- cgit