天天看点

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED

Hexagon_V65_Programmers_Reference_Manual(17)

  • 11.1.2 ALU32/PERM
    • 将单词组合成双字
    • MUX
    • 将字移位16
    • 打包高半字和低半字
  • 11.1.3 ALU32/PRED
    • 额外加
    • 条件移位半字
    • 条件联合收割机
    • 条件逻辑运算
    • 条件减法
    • 条件符号扩展
    • 有条件转移
    • 条件零扩展
    • 比较
    • 与普通寄存器相比

11.1.2 ALU32/PERM

ALU32/PERM指令子类包括重新排列或执行以下操作的指令:

矢量数据类型的格式转换

将单词组合成双字

将半字或多个字组合成较大的值。

在半字组合中,第一个源寄存器的高半字或低半字为传输到目标寄存器的最高有效半字第二源寄存器的高半字或低半字被转移到最低有效位目标寄存器的半字。源寄存器和目标寄存器为32位。

在字组合中,第一个源寄存器被转移到最重要的字而第二源寄存器被转移到目标寄存器的最低有效字。源寄存器为32位,目标寄存器为寄存器为64位。

在字组合的一种变体中,使用带符号的8位立即值(而不是寄存器)传输到64位目标寄存器的最高和最低有效字。

可选地,即时值之一可以是32位。

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Syntax 								Behavior
Rd=combine(Rt.[HL],Rs.[HL]) 		Rd = (Rt.uh[01]<<16) | Rs.uh[01];
Rdd=combine(#s8,#S8) 				apply_extension(#s);
									Rdd.w[0]=#S;
									Rdd.w[1]=#s;
Rdd=combine(#s8,#U6) 				apply_extension(#U);				
									Rdd.w[1]=#s;						
									Rdd.w[0]=#U;
Rdd=combine(#s8,Rs) 				apply_extension(#s);
									Rdd.w[0]=Rs;
									Rdd.w[1]=#s;
Rdd=combine(Rs,#s8) 				apply_extension(#s);
									Rdd.w[0]=#s;
									Rdd.w[1]=Rs;
Rdd=combine(Rs,Rt)				    Rdd.w[0]=Rt;
									Rdd.w[1]=Rs;


           

类别:ALU32(插槽0,1,2,3)

内部函数

Rd=combine(Rt.H,Rs.H) 	 Word32 Q6_R_combine_RhRh(Word32 Rt, Word32 Rs)
Rd=combine(Rt.H,Rs.L) 	 Word32 Q6_R_combine_RhRl(Word32 Rt, Word32 Rs)
Rd=combine(Rt.L,Rs.H) 	 Word32 Q6_R_combine_RlRh(Word32 Rt, Word32 Rs)
Rd=combine(Rt.L,Rs.L)	 Word32 Q6_R_combine_RlRl(Word32 Rt, Word32 Rs)
Rdd=combine(#s8,#S8)	 Word64 Q6_P_combine_II(Word32 Is8, Word32 IS8)
Rdd=combine(#s8,Rs)		 Word64 Q6_P_combine_IR(Word32 Is8, Word32 Rs)
Rdd=combine(Rs,#s8)		 Word64 Q6_P_combine_RI(Word32 Rs, Word32 Is8)
Rdd=combine(Rs,Rt) 		 Word64 Q6_P_combine_RR(Word32 Rs, Word32 Rt)
	
           

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp 			 Minor Opcode
Rs				 No Rs read
C 			  	 Conditional
ICLASS			 Instruction Class
Parse 			 Packet/Loop parse bits
P				 Predicated
d5				 Field to encode register d
s5 			   	 Field to encode register s
           

MUX

基于谓词的最低有效位在两个源寄存器之间进行选择登记如果位为1,则将第一源寄存器转移到目标寄存器;

否则,传输第二个源寄存器。源寄存器和目标寄存器为32位。

在多路复用器的一种变体中,可以使用带符号的8位立即数值代寄存器来执行以下操作:

源操作数中的一个或两个。

有关此指令的64位版本,请参阅XTYPE vmux指令。

Syntax 					Behavior
Rd=mux(Pu,#s8,#S8) 		PREDUSE_TIMING;
						apply_extension(#s);
						(Pu[0]) ? (Rd=#s):(Rd=#S);
Rd=mux(Pu,#s8,Rs) 		PREDUSE_TIMING;
						apply_extension(#s);
						(Pu[0]) ? (Rd=#s):(Rd=Rs);
Rd=mux(Pu,Rs,#s8) 		PREDUSE_TIMING;
						apply_extension(#s);
						(Pu[0]) ? (Rd=Rs):(Rd=#s);
Rd=mux(Pu,Rs,Rt) 		PREDUSE_TIMING;
						(Pu[0]) ? (Rd=Rs):(Rd=Rt);
           

类别:ALU32(插槽0,1,2,3)

内部函数

Rd=mux(Pu,#s8,#S8) Word32 Q6_R_mux_pII(Byte Pu, Word32 Is8, Word32 
IS8)
Rd=mux(Pu,#s8,Rs)  Word32 Q6_R_mux_pIR(Byte Pu, Word32 Is8, Word32 
Rs)
Rd=mux(Pu,Rs,#s8)  Word32 Q6_R_mux_pRI(Byte Pu, Word32 Rs, Word32 
Is8)
Rd=mux(Pu,Rs,Rt)   Word32 Q6_R_mux_pRR(Byte Pu, Word32 Rs, Word32 Rt)

           

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp 			 Minor Opcode
Rs				 No Rs read
C 			  	 Conditional
ICLASS			 Instruction Class
Parse 			 Packet/Loop parse bits
P				 Predicated
d5				 Field to encode register d
s5 			   	 Field to encode register s
u1 				 Field to encode register u
u2 				 Field to encode register u

           

将字移位16

ASLH将32位源寄存器算术左移位16位(1位)半字)。目标的较低16位为零填充。

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Syntax 		 Behavior
Rd=aslh(Rs)  Rd=Rs<<16;
Rd=asrh(Rs)  Rd=Rs>>16;
           

类别:ALU32(插槽0,1,2,3)

内部函数

Rd=aslh(Rs) 	Word32 Q6_R_aslh_R(Word32 Rs)
Rd=asrh(Rs) 	Word32 Q6_R_asrh_R(Word32 Rs)
           

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp 			 Minor Opcode
Rs				 No Rs read
C 			  	 Conditional
Parse 			 Packet/Loop parse bits
d5				 Field to encode register d
s5 			   	 Field to encode register s
           

打包高半字和低半字

将Rs和Rt中最重要的半字组合成最重要的一个半字寄存器对Rdd的字以及来自Rs和Rt的最低有效半字输入到Rdd的最低有效半字。

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Syntax 				Behavior
Rdd=packhl(Rs,Rt) 	Rdd.h[0]=Rt.h[0];
					Rdd.h[1]=Rs.h[0];
					Rdd.h[2]=Rt.h[1];
					Rdd.h[3]=Rs.h[1];
           

类别:ALU32(插槽0,1,2,3)

内部函数

Rdd=packhl(Rs,Rt)     Word64 Q6_P_packhl_RR(Word32 Rs, Word32 Rt
           

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp 			 Minor Opcode
Rs				 No Rs read
C 			  	 Conditional
Parse 			 Packet/Loop parse bits
d5				 Field to encode register d
s5 			   	 Field to encode register s
           

11.1.3 ALU32/PRED

额外加

如果设置了谓词Pu的最低有效位,则向其中一个添加32位源寄存器另一个寄存器或立即值。结果放入32位目标寄存器。如果谓词为false,指令不执行任何操作。

Syntax 								Behavior
if ([!]Pu[.new]) Rd=add(Rs,#s8) 	if([!]Pu[.new][0]){
									apply_extension(#s);
									Rd=Rs+#s;
									} else {
									NOP;
									}
if ([!]Pu[.new]) Rd=add(Rs,Rt) 		if([!]Pu[.new][0]){
									Rd=Rs+Rt;
									} else {
									NOP;
									}
           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp 			 Minor Opcode
Rs				 No Rs read
DN				 Dot-new
PS 				 Predicate sense
DN 				 Dot-new
C 			  	 Conditional
Parse 			 Packet/Loop parse bits
d5				 Field to encode register d
s5 			   	 Field to encode register s
t5 				 Field to encode register t
u2 				 Field to encode register u
ICLASS 		 	 Instruction Class
           

条件移位半字

有条件地移位半字。

ASLH将32位源寄存器算术左移位16位(1位)半字)。目标的较低16位为零填充。

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Syntax 						Behavior
if ([!]Pu[.new]) Rd=aslh(Rs) 	if([!]Pu[.new][0]){
								Rd=Rs<<16;
								} else {
								NOP;
								}
if ([!]Pu[.new]) Rd=asrh(Rs)	if([!]Pu[.new][0]){
								Rd=Rs>>16;
								} else {
								NOP;
								}

           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp 			 Minor Opcode
Rs				 No Rs read
C 			  	 Conditional
S 				 Predicate sense
Parse 			 Packet/Loop parse bits
d5				 Field to encode register d
s5 			   	 Field to encode register s
u2 				 Field to encode register u
ICLASS 		 	 Instruction Class
           

条件联合收割机

如果设置了谓词Pu的最低有效位Rdd取自第一源寄存器Rs,而最低有效字取自寄存器Rs来自第二个源寄存器Rt。如果谓词为false,则此指令不执行任何操作

Syntax					 Behavior
if ([!]Pu[.new]) 		if ([!]Pu[.new][0]) {
Rdd=combine(Rs,Rt)		Rdd.w[0]=Rt;
						Rdd.w[1]=Rs;
						} else {
						NOP;
						}

           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
D				 Dot-new
Rs				 No Rs read
C 			  	 Conditional
P 				 Predicated
PS 				 Predicate sense
Parse 			 Packet/Loop parse bits
ICLASS 		 	 Instruction Class
d5				 Field to encode register d
s5 			   	 Field to encode register s
u2 				 Field to encode register u
           

条件逻辑运算

如果设置了谓词Pu的最低有效位,则对源执行逻辑操作价值观结果放入32位目标寄存器。如果谓词为false,则指令不起任何作用。

Syntax 									Behavior
if ([!]Pu[.new]) Rd=and(Rs,Rt) 			if([!]Pu[.new][0]){
										Rd=Rs&Rt;
										} else {
										NOP;
										}
if ([!]Pu[.new]) Rd=or(Rs,Rt) 			if([!]Pu[.new][0]){
										Rd=Rs|Rt;
										} else {
										NOP;
										}
if ([!]Pu[.new]) Rd=xor(Rs,Rt) 			if([!]Pu[.new][0]){
										Rd=Rs^Rt;
										} else {
										NOP;
										}
           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
DN				 Dot-new
Rs				 No Rs read
C 			  	 Conditional
P 				 Predicated
PS 				 Predicate sense
Parse 			 Packet/Loop parse bits
ICLASS 		 	 Instruction Class
d5				 Field to encode register d
s5 			   	 Field to encode register s
t5				 Field to encode register t
u2 				 Field to encode register u
           

条件减法

如果设置了谓词Pu的最低有效位,则从中减去32位源寄存器Rt寄存器Rs。结果放在32位目标寄存器中。如果谓词为false,则指令不起任何作用。

Syntax 								Behavior
if ([!]Pu[.new]) Rd=sub(Rt,Rs) 		 if([!]Pu[.new][0]){
									Rd=Rt-Rs;
									} else {
									NOP;
									}

           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp			 Minor Opcode
P 				 Predicated
PS 				 Predicate sense
Parse 			 Packet/Loop parse bits
ICLASS 		 	 Instruction Class
Parse			 Packet/Loop parse bits
d5				 Field to encode register d
s5 			   	 Field to encode register s
t5				 Field to encode register t
u2 				 Field to encode register u
           

条件符号扩展

条件符号:从Rs扩展最低有效字节或半字,并将32位导致Rd。

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Syntax 							Behavior
if ([!]Pu[.new]) Rd=sxtb(Rs) 	if([!]Pu[.new][0]){
								Rd=sxt8->32(Rs);
								} else {
								NOP;
								}
if ([!]Pu[.new]) Rd=sxth(Rs) 	if([!]Pu[.new][0]){
								Rd=sxt16->32(Rs);
								} else {
								NOP;
								}

           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp			 Minor Opcode
RS 				 No Rs read
C 				 Conditional
S 				 Predicate sense
dn			 	 Dot-new
ICLASS 		 	 Instruction Class
Parse			 Packet/Loop parse bits
d5				 Field to encode register d
s5 			   	 Field to encode register s
u2 				 Field to encode register u
           

有条件转移

如果设置了谓词Pu的LSB,则将寄存器Rs或有符号立即数转移到

目标Rd。如果谓词为false,则此指令不执行任何操作。

Syntax 										Behavior
if ([!]Pu[.new]) Rd=#s12 					apply_extension(#s);
											if ([!]Pu[.new][0]) Rd=#s;
											else NOP;
if ([!]Pu[.new]) Rd=Rs Assembler			 mapped to: "if ([!]Pu[.new]) 
											Rd=add(Rs,#0)"
if ([!]Pu[.new]) Rdd=Rss Assembler 			mapped to: "if ([!]Pu[.new]) 
											Rdd=combine(Rss.H32,Rss.L32)"
           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp			 Minor Opcode
RS 				 No Rs read
dn			 	 Dot-new
PS				 Predicate sense
ICLASS 		 	 Instruction Class
Parse			 Packet/Loop parse bits
d5				 Field to encode register d
u2 				 Field to encode register u
           

条件零扩展

有条件地零,从Rs扩展最低有效字节或半字,并将32位导致Rd。

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Syntax 								Behavior
if ([!]Pu[.new]) Rd=zxtb(Rs) 		if([!]Pu[.new][0]){
									Rd=zxt8->32(Rs);
									} else {
									NOP;
									}
if ([!]Pu[.new]) Rd=zxth(Rs) 		if([!]Pu[.new][0]){
									Rd=zxt16->32(Rs);
									} else {
									NOP;
									}

           

类别:ALU32(插槽0,1,2,3)

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp			 Minor Opcode
RS 				 No Rs read
C 				Conditional
S				 Predicate sense
dn			 	 Dot-new
ICLASS 		 	 Instruction Class
Parse			 Packet/Loop parse bits
d5				 Field to encode register d
u2 				 Field to encode register u
           

比较

寄存器形式比较两个32位寄存器的无符号大于、大于或同的

立即数形式将寄存器与有符号或无符号立即数值进行比较。

8位谓词寄存器Pd根据结果设置为全部1或全部0。对于64位有关此指令的版本,请参阅XTYPE比较指令。

Syntax 							Behavior
Pd=[!]cmp.eq(Rs,#s10) 			apply_extension(#s);
								Pd=Rs[!]=#s ? 0xff : 0x00;
Pd=[!]cmp.eq(Rs,Rt) 			Pd=Rs[!]=Rt ? 0xff : 0x00;
Pd=[!]cmp.gt(Rs,#s10) 			apply_extension(#s);
								Pd=Rs<=#s ? 0xff : 0x000;
Pd=[!]cmp.gt(Rs,Rt) 			Pd=Rs<=Rt ? 0xff : 0x00;
Pd=[!]cmp.gtu(Rs,#u9) 			apply_extension(#u);
								Pd=Rs.uw[0]<=#u ? 0xff : 0x00;
Pd=[!]cmp.gtu(Rs,Rt) 			Pd=Rs.uw[0]<=Rt.uw[0] ? 0xff : 0x00;
Pd=cmp.ge(Rs,#s8) 				Assembler mapped to: "Pd=cmp.gt(Rs,#s8-1)"
Pd=cmp.geu(Rs,#u8) 				if ("#u8==0") {
								Assembler mapped to: "Pd=cmp.eq(Rs,Rs)";
								} else {
								Assembler mapped to: "Pd=cmp.gtu(Rs,#u8-1)";
								}
Pd=cmp.lt(Rs,Rt) 				Assembler mapped to: "Pd=cmp.gt(Rt,Rs)"
Pd=cmp.ltu(Rs,Rt) 				Assembler mapped to: "Pd=cmp.gtu(Rt,Rs)"

           

类别:ALU32(插槽0,1,2,3)

Pd=!cmp.eq(Rs,#s10) 	Byte Q6_p_not_cmp_eq_RI(Word32 Rs, Word32 Is10)
Pd=!cmp.eq(Rs,Rt) 		Byte Q6_p_not_cmp_eq_RR(Word32 Rs, Word32 Rt)
Pd=!cmp.gt(Rs,#s10) 	Byte Q6_p_not_cmp_gt_RI(Word32 Rs, Word32 Is10)
Pd=!cmp.gt(Rs,Rt) 		Byte Q6_p_not_cmp_gt_RR(Word32 Rs, Word32 Rt)
Pd=!cmp.gtu(Rs,#u9) 	Byte Q6_p_not_cmp_gtu_RI(Word32 Rs, Word32 Iu9)
Pd=!cmp.gtu(Rs,Rt) 		Byte Q6_p_not_cmp_gtu_RR(Word32 Rs, Word32 Rt)
Pd=cmp.eq(Rs,#s10) 		Byte Q6_p_cmp_eq_RI(Word32 Rs, Word32 Is10)
Pd=cmp.eq(Rs,Rt) 		Byte Q6_p_cmp_eq_RR(Word32 Rs, Word32 Rt)
Pd=cmp.ge(Rs,#s8) 		Byte Q6_p_cmp_ge_RI(Word32 Rs, Word32 Is8)
Pd=cmp.geu(Rs,#u8) 		Byte Q6_p_cmp_geu_RI(Word32 Rs, Word32 Iu8)
Pd=cmp.gt(Rs,#s10) 		Byte Q6_p_cmp_gt_RI(Word32 Rs, Word32 Is10)
Pd=cmp.gt(Rs,Rt) 		Byte Q6_p_cmp_gt_RR(Word32 Rs, Word32 Rt)
Pd=cmp.gtu(Rs,#u9) 		Byte Q6_p_cmp_gtu_RI(Word32 Rs, Word32 Iu9)
Pd=cmp.gtu(Rs,Rt) 		Byte Q6_p_cmp_gtu_RR(Word32 Rs, Word32 Rt)
Pd=cmp.lt(Rs,Rt) 		Byte Q6_p_cmp_lt_RR(Word32 Rs, Word32 Rt)
Pd=cmp.ltu(Rs,Rt) 		Byte Q6_p_cmp_ltu_RR(Word32 Rs, Word32 Rt)
           

解码

.

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp			 Minor Opcode
RS 				 No Rs read
P 				 Predicated
dn			 	 Dot-new
ICLASS 		 	 Instruction Class
Parse			 Packet/Loop parse bits
d5				 Field to encode register d
u2 				 Field to encode register u
t5 				 Field to encode register t
           

与普通寄存器相比

寄存器形式比较两个32位寄存器的无符号大于、大于或相同的立即数形式将寄存器与有符号或无符号立即数进行比较价值得到的零或一放入通用寄存器。

Syntax 					Behavior
Rd=[!]cmp.eq(Rs,#s8) 	apply_extension(#s);
						Rd=(Rs[!]=#s);
Rd=[!]cmp.eq(Rs,Rt)		Rd=(Rs[!]=Rt);

           

类别:ALU32(插槽0,1,2,3)

内置函数

Rd=!cmp.eq(Rs,#s8)	 Word32 Q6_R_not_cmp_eq_RI(Word32 Rs, Word32 Is8)
Rd=!cmp.eq(Rs,Rt)	 Word32 Q6_R_not_cmp_eq_RR(Word32 Rs, Word32 Rt)
Rd=cmp.eq(Rs,#s8) 	 Word32 Q6_R_cmp_eq_RI(Word32 Rs, Word32 Is8)
Rd=cmp.eq(Rs,Rt) 	 Word32 Q6_R_cmp_eq_RR(Word32 Rs, Word32 Rt)

           

解码

Hexagon_V65_Programmers_Reference_Manual(17)11.1.2 ALU32/PERM11.1.3 ALU32/PRED
Field name 		Description
MajOp			 Major Opcode
MinOp			 Minor Opcode
RS 				 No Rs read
MajOp			 Major Opcode
MinOp			 Minor Opcode
P 				 Predicated
ICLASS 		 	 Instruction Class
Parse			 Packet/Loop parse bits
d5				 Field to encode register d
u2 				 Field to encode register u
t5 				 Field to encode register t
           

继续阅读