if then else constructs and ptx backend

Deneau, Tom tom.deneau at amd.com
Sat Apr 27 06:26:54 PDT 2013


Hi --

I am working with Vasanth on the HSAIL backend.  As you may know we patterned this
after some of the PTX backend work.  We have noticed a problem with if then else constructs
and I see a similar problem in the PTX backend.  Below is some java code and the ptx code.
Note the dangling if block at L233.

Can you tell us where we should start to look to solve this problem?

-- Tom Deneau


Java code:
  public static int testIfThen(int a) {
	return (a > 5 ? a + 7 : a - 3);
    }


testIfThen: 
.entry testIfThen (	
	.param .u32 param0
) {	
	  .reg .pred %p,%q;
	  .reg .u32 %r<16>;
	.version 1.4
	.target sm_10
L117:
	setp.ge.s32 %p, 5, %r6;
	@%p 
	bra L2147483647;         # I assume this should really be bra L233
L172:
	sub.s32 %r6, %r6, 3;
L200:
	mov.s32 %r0, %r6;
	exit; 
L233:
	add.s32 %r6, %r6, 7;     # doesn't rejoin the main flow to exit 
}	




More information about the graal-dev mailing list