Use a better NOT; and after remembering that PowerPC bit numbers are all
backwards in the documentation, rewrote IFEQ/IFLT/IFLE to actually work. Probably. Thanks to the B test suite for spotting this.
This commit is contained in:
		
							parent
							
								
									77fc62285d
								
							
						
					
					
						commit
						0da248dced
					
				
					 1 changed files with 10 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -572,26 +572,26 @@ PATTERNS
 | 
			
		|||
 | 
			
		||||
    out:(int)reg = IFEQ.I(in:(cr)cr)
 | 
			
		||||
        emit "mfcr %out" /* get cr0 */
 | 
			
		||||
        emit "rlwinm %out, %out, [32-2], 2, 31" /* extract just EQ */
 | 
			
		||||
        emit "rlwinm %out, %out, 3, 31, 31"      /* extract just EQ */
 | 
			
		||||
        cost 8;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
    out:(int)reg = IFEQ.I(in:(int)reg)
 | 
			
		||||
        emit "cntlzw %out, %in" /* returns 0..32 */
 | 
			
		||||
        emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */
 | 
			
		||||
        emit "rlwinm %out, %out, [32-5], 31, 31" /* if 32, return 1, otherwise 0 */
 | 
			
		||||
        cost 8;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    out:(int)reg = IFLT.I(in:(cr)cr)
 | 
			
		||||
        emit "mfcr %out" /* get cr0 */
 | 
			
		||||
        emit "andi. %out, %out, 1" /* leave just LT */
 | 
			
		||||
        emit "rlwinm %out, %out, 1, 31, 31"     /* leave just LT */
 | 
			
		||||
        cost 8;
 | 
			
		||||
 | 
			
		||||
    out:(int)reg = IFLE.I(in:(cr)cr)
 | 
			
		||||
        emit "mfcr %out"                        /* get cr0 */
 | 
			
		||||
        emit "andi. %out, %out, 5"              /* leave just LT and EQ */
 | 
			
		||||
        emit "cntlzw %out, %out"                /* returns 0..32 */
 | 
			
		||||
        emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */
 | 
			
		||||
        emit "rlwinm %out, %out, 2, 31, 31"     /* leave just GT */
 | 
			
		||||
        emit "xori %out, %out, 1"               /* negate */
 | 
			
		||||
        cost 8;
 | 
			
		||||
        cost 12;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -673,10 +673,9 @@ PATTERNS
 | 
			
		|||
        emit "neg %out, %left"
 | 
			
		||||
        cost 4;
 | 
			
		||||
 | 
			
		||||
    out:(int)reg = NOT.I(left:(int)reg)
 | 
			
		||||
        emit "cntlzw %out, %left"
 | 
			
		||||
        emit "rlwinm %out, %out, 32-5, 5, 31"
 | 
			
		||||
        cost 8;
 | 
			
		||||
    out:(int)reg = NOT.I(in:(int)reg)
 | 
			
		||||
        emit "nor %out, %in, %in"
 | 
			
		||||
        cost 4;
 | 
			
		||||
 | 
			
		||||
    ALUR(AND.I, "and")
 | 
			
		||||
    ALUCC(AND.I, "andi.")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue