aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel
diff options
context:
space:
mode:
authorZi Shen Lim <zlim.lnx@gmail.com>2014-08-27 00:15:28 -0400
committerWill Deacon <will.deacon@arm.com>2014-09-08 09:39:20 -0400
commit27f95ba59b34509dc8afa2f89ad51c044df9d7c7 (patch)
tree219c0e3152d4a5e3ccd323bb50f339948ff94876 /arch/arm64/kernel
parent6481063989283f7cbeb0b6c38506ba4dd319f93a (diff)
arm64: introduce aarch64_insn_gen_data3()
Introduce function to generate data-processing (3 source) instructions. Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r--arch/arm64/kernel/insn.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index c054164c677b..f73a4bfbb946 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -302,6 +302,7 @@ static u32 aarch64_insn_encode_register(enum aarch64_insn_register_type type,
302 shift = 5; 302 shift = 5;
303 break; 303 break;
304 case AARCH64_INSN_REGTYPE_RT2: 304 case AARCH64_INSN_REGTYPE_RT2:
305 case AARCH64_INSN_REGTYPE_RA:
305 shift = 10; 306 shift = 10;
306 break; 307 break;
307 case AARCH64_INSN_REGTYPE_RM: 308 case AARCH64_INSN_REGTYPE_RM:
@@ -832,3 +833,44 @@ u32 aarch64_insn_gen_data2(enum aarch64_insn_register dst,
832 833
833 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn, reg); 834 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn, reg);
834} 835}
836
837u32 aarch64_insn_gen_data3(enum aarch64_insn_register dst,
838 enum aarch64_insn_register src,
839 enum aarch64_insn_register reg1,
840 enum aarch64_insn_register reg2,
841 enum aarch64_insn_variant variant,
842 enum aarch64_insn_data3_type type)
843{
844 u32 insn;
845
846 switch (type) {
847 case AARCH64_INSN_DATA3_MADD:
848 insn = aarch64_insn_get_madd_value();
849 break;
850 case AARCH64_INSN_DATA3_MSUB:
851 insn = aarch64_insn_get_msub_value();
852 break;
853 default:
854 BUG_ON(1);
855 }
856
857 switch (variant) {
858 case AARCH64_INSN_VARIANT_32BIT:
859 break;
860 case AARCH64_INSN_VARIANT_64BIT:
861 insn |= AARCH64_INSN_SF_BIT;
862 break;
863 default:
864 BUG_ON(1);
865 }
866
867 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
868
869 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RA, insn, src);
870
871 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn,
872 reg1);
873
874 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn,
875 reg2);
876}