On 09/25/2015 12:56 PM, Nathan Sidwell wrote:
On 09/25/15 06:28, Bernd Schmidt wrote:
Can you send me the patch you tried (and possibly a testcase you
expect to be
handled), I'll see if I can find out what's going on.

Thanks!  When things didn't work, I tried getting it workong on the
gomp4 branch, as I new what to expect there.  So the patch is for that
branch.

The fails I observed are:

FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/if-1.c
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none
execution test

Ok, I tried to compile this one. When using -O for host cc1 and ptx lto1, I see fold_builtin_1 being executed with state == EXPANSION.

In host cc1:

10294             return fold_convert (integer_type_node, result);
(gdb) p result
$16 = <truth_or_expr 0x7ffff06e57a8>
(gdb) pge
warning: Expression is not an assignment (and might have no effect)
2 == 2 || 2 == 0

In ptx lto1:

(gdb) p result
$1 = <truth_or_expr 0x7ffff0875910>
(gdb) pge
warning: Expression is not an assignment (and might have no effect)
2 == 4 || 2 == 5

I'm not really sure about the logic, but are the results maybe switched (returning false on the device and true on the host)?

I think the reason you're seeing calls to acc_on_device when not optimizing is this code:

5931 /* When not optimizing, generate calls to library functions for a certain
5932         set of builtins.  */
5933      if (!optimize
5934          && !called_as_built_in (fndecl)
5935          && fcode != BUILT_IN_FORK
[...]

which should probably have the acc_on_device code added to the list.


Bernd

Reply via email to