forked from eden-emu/eden
		
	Merge pull request #551 from bunnei/shr
gl_shader_decompiler: Implement SHR instruction.
This commit is contained in:
		
						commit
						5f2f250915
					
				
					 2 changed files with 17 additions and 0 deletions
				
			
		|  | @ -260,6 +260,10 @@ union Instruction { | ||||||
|         } |         } | ||||||
|     } alu; |     } alu; | ||||||
| 
 | 
 | ||||||
|  |     union { | ||||||
|  |         BitField<48, 1, u64> is_signed; | ||||||
|  |     } shift; | ||||||
|  | 
 | ||||||
|     union { |     union { | ||||||
|         BitField<39, 5, u64> shift_amount; |         BitField<39, 5, u64> shift_amount; | ||||||
|         BitField<48, 1, u64> negate_b; |         BitField<48, 1, u64> negate_b; | ||||||
|  |  | ||||||
|  | @ -979,6 +979,19 @@ private: | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             switch (opcode->GetId()) { |             switch (opcode->GetId()) { | ||||||
|  |             case OpCode::Id::SHR_C: | ||||||
|  |             case OpCode::Id::SHR_R: | ||||||
|  |             case OpCode::Id::SHR_IMM: { | ||||||
|  |                 if (!instr.shift.is_signed) { | ||||||
|  |                     // Logical shift right
 | ||||||
|  |                     op_a = "uint(" + op_a + ')'; | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 // Cast to int is superfluous for arithmetic shift, it's only for a logical shift
 | ||||||
|  |                 regs.SetRegisterToInteger(instr.gpr0, true, 0, "int(" + op_a + " >> " + op_b + ')', | ||||||
|  |                                           1, 1); | ||||||
|  |                 break; | ||||||
|  |             } | ||||||
|             case OpCode::Id::SHL_C: |             case OpCode::Id::SHL_C: | ||||||
|             case OpCode::Id::SHL_R: |             case OpCode::Id::SHL_R: | ||||||
|             case OpCode::Id::SHL_IMM: |             case OpCode::Id::SHL_IMM: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bunnei
						bunnei