From cdba4e1bccb84a909db3f4183147f2e543f2ea10 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Tue, 3 Feb 2015 18:01:45 +0000 Subject: [PATCH] [Hexagon] Adding vector intrinsics for alu32/alu and xtype/alu. llvm-svn: 227993 --- llvm/lib/Target/Hexagon/HexagonIntrinsics.td | 268 +++++-------- llvm/lib/Target/Hexagon/HexagonIntrinsicsV4.td | 31 ++ llvm/test/CodeGen/Hexagon/intrinsics/alu32_alu.ll | 66 +++ llvm/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll | 467 ++++++++++++++++++++++ 4 files changed, 657 insertions(+), 175 deletions(-) diff --git a/llvm/lib/Target/Hexagon/HexagonIntrinsics.td b/llvm/lib/Target/Hexagon/HexagonIntrinsics.td index e4d8c44..ec2b5db 100644 --- a/llvm/lib/Target/Hexagon/HexagonIntrinsics.td +++ b/llvm/lib/Target/Hexagon/HexagonIntrinsics.td @@ -629,6 +629,22 @@ def : Pat <(i32 (int_hexagon_C2_cmpltu (I32:$src1), (i32 (C2_cmpgtu (I32:$src2), (I32:$src1)))>; /******************************************************************** +* ALU32/VH * +*********************************************************************/ +// Vector add, subtract, average halfwords +def: T_RR_pat; +def: T_RR_pat; +def: T_RR_pat; + +def: T_RR_pat; +def: T_RR_pat; +def: T_RR_pat; + +def: T_RR_pat; +def: T_RR_pat; +def: T_RR_pat; + +/******************************************************************** * ALU64/ALU * *********************************************************************/ def: T_RR_pat; @@ -647,6 +663,83 @@ def: T_PP_pat; def: T_PP_pat; def: T_RR_pat; +/******************************************************************** +* ALU64/VB * +*********************************************************************/ +// ALU64 - Vector add +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector average +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector negative average +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector max +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector min +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector sub +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector compare bytes +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector compare halfwords +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 - Vector compare words +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// ALU64 / VB / Vector mux. +def : Pat<(int_hexagon_C2_vmux PredRegs:$Pu, DoubleRegs:$Rs, DoubleRegs:$Rt), + (C2_vmux PredRegs:$Pu, DoubleRegs:$Rs, DoubleRegs:$Rt)>; + // MPY - Multiply and use full result // Rdd = mpy[u](Rs, Rt) def : T_RR_pat ; @@ -1387,60 +1480,6 @@ class di_LDInstPI_diu4 [], "$src1 = $dst">; -/******************************************************************** -* ALU32/VH * -*********************************************************************/ - -// ALU32 / VH / Vector add halfwords. -// Rd32=vadd[u]h(Rs32,Rt32:sat] -def HEXAGON_A2_svaddh: - si_ALU32_sisi <"vaddh", int_hexagon_A2_svaddh>; -def HEXAGON_A2_svaddhs: - si_ALU32_sisi_sat <"vaddh", int_hexagon_A2_svaddhs>; -def HEXAGON_A2_svadduhs: - si_ALU32_sisi_sat <"vadduh", int_hexagon_A2_svadduhs>; - -// ALU32 / VH / Vector average halfwords. -def HEXAGON_A2_svavgh: - si_ALU32_sisi <"vavgh", int_hexagon_A2_svavgh>; -def HEXAGON_A2_svavghs: - si_ALU32_sisi_rnd <"vavgh", int_hexagon_A2_svavghs>; -def HEXAGON_A2_svnavgh: - si_ALU32_sisi <"vnavgh", int_hexagon_A2_svnavgh>; - -// ALU32 / VH / Vector subtract halfwords. -def HEXAGON_A2_svsubh: - si_ALU32_sisi <"vsubh", int_hexagon_A2_svsubh>; -def HEXAGON_A2_svsubhs: - si_ALU32_sisi_sat <"vsubh", int_hexagon_A2_svsubhs>; -def HEXAGON_A2_svsubuhs: - si_ALU32_sisi_sat <"vsubuh", int_hexagon_A2_svsubuhs>; - -// ALU64 / ALU / Transfer register. -def HEXAGON_A2_tfrp: - di_ALU64_di <"", int_hexagon_A2_tfrp>; - -/******************************************************************** -* ALU64/VB * -*********************************************************************/ - -// ALU64 / VB / Vector add unsigned bytes. -def HEXAGON_A2_vaddub: - di_ALU64_didi <"vaddub", int_hexagon_A2_vaddub>; -def HEXAGON_A2_vaddubs: - di_ALU64_didi_sat <"vaddub", int_hexagon_A2_vaddubs>; - -// ALU64 / VB / Vector average unsigned bytes. -def HEXAGON_A2_vavgub: - di_ALU64_didi <"vavgub", int_hexagon_A2_vavgub>; -def HEXAGON_A2_vavgubr: - di_ALU64_didi_rnd <"vavgub", int_hexagon_A2_vavgubr>; - -// ALU64 / VB / Vector compare unsigned bytes. -def HEXAGON_A2_vcmpbeq: - qi_ALU64_didi <"vcmpb.eq", int_hexagon_A2_vcmpbeq>; -def HEXAGON_A2_vcmpbgtu: - qi_ALU64_didi <"vcmpb.gtu",int_hexagon_A2_vcmpbgtu>; // ALU64 / VB / Vector maximum/minimum unsigned bytes. def HEXAGON_A2_vmaxub: @@ -1454,127 +1493,6 @@ def HEXAGON_A2_vsubub: def HEXAGON_A2_vsububs: di_ALU64_didi_sat <"vsubub", int_hexagon_A2_vsububs>; -// ALU64 / VB / Vector mux. -def HEXAGON_C2_vmux: - di_ALU64_qididi <"vmux", int_hexagon_C2_vmux>; - - -/******************************************************************** -* ALU64/VH * -*********************************************************************/ - -// ALU64 / VH / Vector add halfwords. -// Rdd64=vadd[u]h(Rss64,Rtt64:sat] -def HEXAGON_A2_vaddh: - di_ALU64_didi <"vaddh", int_hexagon_A2_vaddh>; -def HEXAGON_A2_vaddhs: - di_ALU64_didi_sat <"vaddh", int_hexagon_A2_vaddhs>; -def HEXAGON_A2_vadduhs: - di_ALU64_didi_sat <"vadduh", int_hexagon_A2_vadduhs>; - -// ALU64 / VH / Vector average halfwords. -// Rdd64=v[n]avg[u]h(Rss64,Rtt64:rnd/:crnd][:sat] -def HEXAGON_A2_vavgh: - di_ALU64_didi <"vavgh", int_hexagon_A2_vavgh>; -def HEXAGON_A2_vavghcr: - di_ALU64_didi_crnd <"vavgh", int_hexagon_A2_vavghcr>; -def HEXAGON_A2_vavghr: - di_ALU64_didi_rnd <"vavgh", int_hexagon_A2_vavghr>; -def HEXAGON_A2_vavguh: - di_ALU64_didi <"vavguh", int_hexagon_A2_vavguh>; -def HEXAGON_A2_vavguhr: - di_ALU64_didi_rnd <"vavguh", int_hexagon_A2_vavguhr>; -def HEXAGON_A2_vnavgh: - di_ALU64_didi <"vnavgh", int_hexagon_A2_vnavgh>; -def HEXAGON_A2_vnavghcr: - di_ALU64_didi_crnd_sat <"vnavgh", int_hexagon_A2_vnavghcr>; -def HEXAGON_A2_vnavghr: - di_ALU64_didi_rnd_sat <"vnavgh", int_hexagon_A2_vnavghr>; - -// ALU64 / VH / Vector compare halfwords. -def HEXAGON_A2_vcmpheq: - qi_ALU64_didi <"vcmph.eq", int_hexagon_A2_vcmpheq>; -def HEXAGON_A2_vcmphgt: - qi_ALU64_didi <"vcmph.gt", int_hexagon_A2_vcmphgt>; -def HEXAGON_A2_vcmphgtu: - qi_ALU64_didi <"vcmph.gtu",int_hexagon_A2_vcmphgtu>; - -// ALU64 / VH / Vector maximum halfwords. -def HEXAGON_A2_vmaxh: - di_ALU64_didi <"vmaxh", int_hexagon_A2_vmaxh>; -def HEXAGON_A2_vmaxuh: - di_ALU64_didi <"vmaxuh", int_hexagon_A2_vmaxuh>; - -// ALU64 / VH / Vector minimum halfwords. -def HEXAGON_A2_vminh: - di_ALU64_didi <"vminh", int_hexagon_A2_vminh>; -def HEXAGON_A2_vminuh: - di_ALU64_didi <"vminuh", int_hexagon_A2_vminuh>; - -// ALU64 / VH / Vector subtract halfwords. -def HEXAGON_A2_vsubh: - di_ALU64_didi <"vsubh", int_hexagon_A2_vsubh>; -def HEXAGON_A2_vsubhs: - di_ALU64_didi_sat <"vsubh", int_hexagon_A2_vsubhs>; -def HEXAGON_A2_vsubuhs: - di_ALU64_didi_sat <"vsubuh", int_hexagon_A2_vsubuhs>; - - -/******************************************************************** -* ALU64/VW * -*********************************************************************/ - -// ALU64 / VW / Vector add words. -// Rdd32=vaddw(Rss32,Rtt32)[:sat] -def HEXAGON_A2_vaddw: - di_ALU64_didi <"vaddw", int_hexagon_A2_vaddw>; -def HEXAGON_A2_vaddws: - di_ALU64_didi_sat <"vaddw", int_hexagon_A2_vaddws>; - -// ALU64 / VW / Vector average words. -def HEXAGON_A2_vavguw: - di_ALU64_didi <"vavguw", int_hexagon_A2_vavguw>; -def HEXAGON_A2_vavguwr: - di_ALU64_didi_rnd <"vavguw", int_hexagon_A2_vavguwr>; -def HEXAGON_A2_vavgw: - di_ALU64_didi <"vavgw", int_hexagon_A2_vavgw>; -def HEXAGON_A2_vavgwcr: - di_ALU64_didi_crnd <"vavgw", int_hexagon_A2_vavgwcr>; -def HEXAGON_A2_vavgwr: - di_ALU64_didi_rnd <"vavgw", int_hexagon_A2_vavgwr>; -def HEXAGON_A2_vnavgw: - di_ALU64_didi <"vnavgw", int_hexagon_A2_vnavgw>; -def HEXAGON_A2_vnavgwcr: - di_ALU64_didi_crnd_sat <"vnavgw", int_hexagon_A2_vnavgwcr>; -def HEXAGON_A2_vnavgwr: - di_ALU64_didi_rnd_sat <"vnavgw", int_hexagon_A2_vnavgwr>; - -// ALU64 / VW / Vector compare words. -def HEXAGON_A2_vcmpweq: - qi_ALU64_didi <"vcmpw.eq", int_hexagon_A2_vcmpweq>; -def HEXAGON_A2_vcmpwgt: - qi_ALU64_didi <"vcmpw.gt", int_hexagon_A2_vcmpwgt>; -def HEXAGON_A2_vcmpwgtu: - qi_ALU64_didi <"vcmpw.gtu",int_hexagon_A2_vcmpwgtu>; - -// ALU64 / VW / Vector maximum words. -def HEXAGON_A2_vmaxw: - di_ALU64_didi <"vmaxw", int_hexagon_A2_vmaxw>; -def HEXAGON_A2_vmaxuw: - di_ALU64_didi <"vmaxuw", int_hexagon_A2_vmaxuw>; - -// ALU64 / VW / Vector minimum words. -def HEXAGON_A2_vminw: - di_ALU64_didi <"vminw", int_hexagon_A2_vminw>; -def HEXAGON_A2_vminuw: - di_ALU64_didi <"vminuw", int_hexagon_A2_vminuw>; - -// ALU64 / VW / Vector subtract words. -def HEXAGON_A2_vsubw: - di_ALU64_didi <"vsubw", int_hexagon_A2_vsubw>; -def HEXAGON_A2_vsubws: - di_ALU64_didi_sat <"vsubw", int_hexagon_A2_vsubws>; - /******************************************************************** * MTYPE/ALU * *********************************************************************/ diff --git a/llvm/lib/Target/Hexagon/HexagonIntrinsicsV4.td b/llvm/lib/Target/Hexagon/HexagonIntrinsicsV4.td index 58a702c..ae2d463 100644 --- a/llvm/lib/Target/Hexagon/HexagonIntrinsicsV4.td +++ b/llvm/lib/Target/Hexagon/HexagonIntrinsicsV4.td @@ -34,6 +34,10 @@ def : MType_R32_pat ; def : MType_R32_pat ; def : MType_R32_pat ; +// Vector reduce add unsigned halfwords +def : Pat <(int_hexagon_M2_vraddh DoubleRegs:$src1, DoubleRegs:$src2), + (M2_vraddh DoubleRegs:$src1, DoubleRegs:$src2)>; + def : T_P_pat ; def: T_P_pat ; @@ -82,12 +86,39 @@ def : T_RP_pat ; def : T_PII_pat ; def : T_RII_pat ; +// Vector conditional negate +// Rdd=vcnegh(Rss,Rt) +def : T_PR_pat ; + // Shift an immediate left by register amount def : T_IR_pat; +// Vector reduce maximum halfwords +def : T_PPR_pat ; +def : T_PPR_pat ; + +// Vector reduce maximum words +def : T_PPR_pat ; +def : T_PPR_pat ; + +// Vector reduce minimum halfwords +def : T_PPR_pat ; +def : T_PPR_pat ; + +// Vector reduce minimum words +def : T_PPR_pat ; +def : T_PPR_pat ; + +// Vector conditional negate +def : T_PPR_pat; + // Logical xor with xor accumulation def : T_PPP_pat; +// ALU64 - Vector min/max byte +def : T_PP_pat ; +def : T_PP_pat ; + // Shift and add/sub/and/or def : T_IRI_pat ; def : T_IRI_pat ; diff --git a/llvm/test/CodeGen/Hexagon/intrinsics/alu32_alu.ll b/llvm/test/CodeGen/Hexagon/intrinsics/alu32_alu.ll index 6ff9387..37f9f40 100644 --- a/llvm/test/CodeGen/Hexagon/intrinsics/alu32_alu.ll +++ b/llvm/test/CodeGen/Hexagon/intrinsics/alu32_alu.ll @@ -127,6 +127,72 @@ define i32 @A2_tfr(i32 %a) { } ; CHECK: r0 = r0 +; Vector add halfwords +declare i32 @llvm.hexagon.A2.svaddh(i32, i32) +define i32 @A2_svaddh(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svaddh(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vaddh(r0, r1) + +declare i32 @llvm.hexagon.A2.svaddhs(i32, i32) +define i32 @A2_svaddhs(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svaddhs(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vaddh(r0, r1):sat + +declare i32 @llvm.hexagon.A2.svadduhs(i32, i32) +define i32 @A2_svadduhs(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svadduhs(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vadduh(r0, r1):sat + +; Vector average halfwords +declare i32 @llvm.hexagon.A2.svavgh(i32, i32) +define i32 @A2_svavgh(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svavgh(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vavgh(r0, r1) + +declare i32 @llvm.hexagon.A2.svavghs(i32, i32) +define i32 @A2_svavghs(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svavghs(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vavgh(r0, r1):rnd + +declare i32 @llvm.hexagon.A2.svnavgh(i32, i32) +define i32 @A2_svnavgh(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svnavgh(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vnavgh(r0, r1) + +; Vector subtract halfwords +declare i32 @llvm.hexagon.A2.svsubh(i32, i32) +define i32 @A2_svsubh(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svsubh(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vsubh(r0, r1) + +declare i32 @llvm.hexagon.A2.svsubhs(i32, i32) +define i32 @A2_svsubhs(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svsubhs(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vsubh(r0, r1):sat + +declare i32 @llvm.hexagon.A2.svsubuhs(i32, i32) +define i32 @A2_svsubuhs(i32 %a, i32 %b) { + %z = call i32 @llvm.hexagon.A2.svsubuhs(i32 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vsubuh(r0, r1):sat + ; Zero extend declare i32 @llvm.hexagon.A2.zxth(i32) define i32 @A2_zxth(i32 %a) { diff --git a/llvm/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll b/llvm/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll index febf4a6..40d9b6b 100644 --- a/llvm/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll +++ b/llvm/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll @@ -551,3 +551,470 @@ define i64 @A2_sxtw(i32 %a) { ret i64 %z } ; CHECK: = sxtw(r0) + +; Vector absolute value halfwords +declare i64 @llvm.hexagon.A2.vabsh(i64) +define i64 @A2_vabsh(i64 %a) { + %z = call i64 @llvm.hexagon.A2.vabsh(i64 %a) + ret i64 %z +} +; CHECK: r1:0 = vabsh(r1:0) + +declare i64 @llvm.hexagon.A2.vabshsat(i64) +define i64 @A2_vabshsat(i64 %a) { + %z = call i64 @llvm.hexagon.A2.vabshsat(i64 %a) + ret i64 %z +} +; CHECK: r1:0 = vabsh(r1:0):sat + +; Vector absolute value words +declare i64 @llvm.hexagon.A2.vabsw(i64) +define i64 @A2_vabsw(i64 %a) { + %z = call i64 @llvm.hexagon.A2.vabsw(i64 %a) + ret i64 %z +} +; CHECK: r1:0 = vabsw(r1:0) + +declare i64 @llvm.hexagon.A2.vabswsat(i64) +define i64 @A2_vabswsat(i64 %a) { + %z = call i64 @llvm.hexagon.A2.vabswsat(i64 %a) + ret i64 %z +} +; CHECK: r1:0 = vabsw(r1:0):sat + +; Vector absolute difference halfwords +declare i64 @llvm.hexagon.M2.vabsdiffh(i64, i64) +define i64 @M2_vabsdiffh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.vabsdiffh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vabsdiffh(r1:0, r3:2) + +; Vector absolute difference words +declare i64 @llvm.hexagon.M2.vabsdiffw(i64, i64) +define i64 @M2_vabsdiffw(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.vabsdiffw(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vabsdiffw(r1:0, r3:2) + +; Vector add halfwords +declare i64 @llvm.hexagon.A2.vaddh(i64, i64) +define i64 @A2_vaddh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vaddh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vaddh(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vaddhs(i64, i64) +define i64 @A2_vaddhs(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vaddhs(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vaddh(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.A2.vadduhs(i64, i64) +define i64 @A2_vadduhs(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vadduhs(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vadduh(r1:0, r3:2):sat + +; Vector add halfwords with saturate and pack to unsigned bytes +declare i32 @llvm.hexagon.A5.vaddhubs(i64, i64) +define i32 @A5_vaddhubs(i64 %a, i64 %b) { + %z = call i32 @llvm.hexagon.A5.vaddhubs(i64 %a, i64 %b) + ret i32 %z +} +; CHECK: r0 = vaddhub(r1:0, r3:2):sat + +; Vector reduce add unsigned bytes +declare i64 @llvm.hexagon.A2.vraddub(i64, i64) +define i64 @A2_vraddub(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vraddub(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vraddub(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vraddub.acc(i64, i64, i64) +define i64 @A2_vraddub_acc(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.A2.vraddub.acc(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vraddub(r3:2, r5:4) + +; Vector reduce add halfwords +declare i32 @llvm.hexagon.M2.vradduh(i64, i64) +define i32 @M2_vradduh(i64 %a, i64 %b) { + %z = call i32 @llvm.hexagon.M2.vradduh(i64 %a, i64 %b) + ret i32 %z +} +; CHECK: r0 = vradduh(r1:0, r3:2) + +declare i32 @llvm.hexagon.M2.vraddh(i64, i64) +define i32 @M2_vraddh(i64 %a, i64 %b) { + %z = call i32 @llvm.hexagon.M2.vraddh(i64 %a, i64 %b) + ret i32 %z +} +; CHECK: r0 = vraddh(r1:0, r3:2) + +; Vector add bytes +declare i64 @llvm.hexagon.A2.vaddub(i64, i64) +define i64 @A2_vaddub(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vaddub(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vaddub(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vaddubs(i64, i64) +define i64 @A2_vaddubs(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vaddubs(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vaddub(r1:0, r3:2):sat + +; Vector add words +declare i64 @llvm.hexagon.A2.vaddw(i64, i64) +define i64 @A2_vaddw(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vaddw(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vaddw(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vaddws(i64, i64) +define i64 @A2_vaddws(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vaddws(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vaddw(r1:0, r3:2):sat + +; Vector average halfwords +declare i64 @llvm.hexagon.A2.vavgh(i64, i64) +define i64 @A2_vavgh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavgh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgh(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vavghr(i64, i64) +define i64 @A2_vavghr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavghr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgh(r1:0, r3:2):rnd + +declare i64 @llvm.hexagon.A2.vavghcr(i64, i64) +define i64 @A2_vavghcr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavghcr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgh(r1:0, r3:2):crnd + +declare i64 @llvm.hexagon.A2.vavguh(i64, i64) +define i64 @A2_vavguh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavguh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavguh(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vavguhr(i64, i64) +define i64 @A2_vavguhr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavguhr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavguh(r1:0, r3:2):rnd + +declare i64 @llvm.hexagon.A2.vnavgh(i64, i64) +define i64 @A2_vnavgh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vnavgh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vnavgh(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vnavghr(i64, i64) +define i64 @A2_vnavghr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vnavghr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vnavgh(r1:0, r3:2):rnd + +declare i64 @llvm.hexagon.A2.vnavghcr(i64, i64) +define i64 @A2_vnavghcr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vnavghcr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vnavgh(r1:0, r3:2):crnd + +; Vector average unsigned bytes +declare i64 @llvm.hexagon.A2.vavgub(i64, i64) +define i64 @A2_vavgub(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavgub(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgub(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vavgubr(i64, i64) +define i64 @A2_vavgubr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavgubr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgub(r1:0, r3:2):rnd + +; Vector average words +declare i64 @llvm.hexagon.A2.vavgw(i64, i64) +define i64 @A2_vavgw(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavgw(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgw(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vavgwr(i64, i64) +define i64 @A2_vavgwr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavgwr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgw(r1:0, r3:2):rnd + +declare i64 @llvm.hexagon.A2.vavgwcr(i64, i64) +define i64 @A2_vavgwcr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavgwcr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavgw(r1:0, r3:2):crnd + +declare i64 @llvm.hexagon.A2.vavguw(i64, i64) +define i64 @A2_vavguw(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavguw(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavguw(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vavguwr(i64, i64) +define i64 @A2_vavguwr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vavguwr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vavguw(r1:0, r3:2):rnd + +declare i64 @llvm.hexagon.A2.vnavgw(i64, i64) +define i64 @A2_vnavgw(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vnavgw(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vnavgw(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vnavgwr(i64, i64) +define i64 @A2_vnavgwr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vnavgwr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vnavgw(r1:0, r3:2):rnd + +declare i64 @llvm.hexagon.A2.vnavgwcr(i64, i64) +define i64 @A2_vnavgwcr(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vnavgwcr(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vnavgw(r1:0, r3:2):crnd + +; Vector conditional negate +declare i64 @llvm.hexagon.S2.vcnegh(i64, i32) +define i64 @S2_vcnegh(i64 %a, i32 %b) { + %z = call i64 @llvm.hexagon.S2.vcnegh(i64 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vcnegh(r1:0, r2) + +declare i64 @llvm.hexagon.S2.vrcnegh(i64, i64, i32) +define i64 @S2_vrcnegh(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.S2.vrcnegh(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vrcnegh(r3:2, r4) + +; Vector maximum bytes +declare i64 @llvm.hexagon.A2.vmaxub(i64, i64) +define i64 @A2_vmaxub(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vmaxub(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmaxub(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vmaxb(i64, i64) +define i64 @A2_vmaxb(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vmaxb(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmaxb(r1:0, r3:2) + +; Vector maximum halfwords +declare i64 @llvm.hexagon.A2.vmaxh(i64, i64) +define i64 @A2_vmaxh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vmaxh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmaxh(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vmaxuh(i64, i64) +define i64 @A2_vmaxuh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vmaxuh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmaxuh(r1:0, r3:2) + +; Vector reduce maximum halfwords +declare i64 @llvm.hexagon.A4.vrmaxh(i64, i64, i32) +define i64 @A4_vrmaxh(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrmaxh(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrmaxh(r3:2, r4) + +declare i64 @llvm.hexagon.A4.vrmaxuh(i64, i64, i32) +define i64 @A4_vrmaxuh(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrmaxuh(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrmaxuh(r3:2, r4) + +; Vector reduce maximum words +declare i64 @llvm.hexagon.A4.vrmaxw(i64, i64, i32) +define i64 @A4_vrmaxw(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrmaxw(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrmaxw(r3:2, r4) + +declare i64 @llvm.hexagon.A4.vrmaxuw(i64, i64, i32) +define i64 @A4_vrmaxuw(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrmaxuw(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrmaxuw(r3:2, r4) + +; Vector minimum bytes +declare i64 @llvm.hexagon.A2.vminub(i64, i64) +define i64 @A2_vminub(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vminub(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vminub(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vminb(i64, i64) +define i64 @A2_vminb(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vminb(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vminb(r1:0, r3:2) + +; Vector minimum halfwords +declare i64 @llvm.hexagon.A2.vminh(i64, i64) +define i64 @A2_vminh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vminh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vminh(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vminuh(i64, i64) +define i64 @A2_vminuh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vminuh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vminuh(r1:0, r3:2) + +; Vector reduce minimum halfwords +declare i64 @llvm.hexagon.A4.vrminh(i64, i64, i32) +define i64 @A4_vrminh(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrminh(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrminh(r3:2, r4) + +declare i64 @llvm.hexagon.A4.vrminuh(i64, i64, i32) +define i64 @A4_vrminuh(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrminuh(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrminuh(r3:2, r4) + +; Vector reduce minimum words +declare i64 @llvm.hexagon.A4.vrminw(i64, i64, i32) +define i64 @A4_vrminw(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrminw(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrminw(r3:2, r4) + +declare i64 @llvm.hexagon.A4.vrminuw(i64, i64, i32) +define i64 @A4_vrminuw(i64 %a, i64 %b, i32 %c) { + %z = call i64 @llvm.hexagon.A4.vrminuw(i64 %a, i64 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 = vrminuw(r3:2, r4) + +; Vector sum of absolute differences unsigned bytes +declare i64 @llvm.hexagon.A2.vrsadub(i64, i64) +define i64 @A2_vrsadub(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vrsadub(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrsadub(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vrsadub.acc(i64, i64, i64) +define i64 @A2_vrsadub_acc(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.A2.vrsadub.acc(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrsadub(r3:2, r5:4) + +; Vector subtract halfwords +declare i64 @llvm.hexagon.A2.vsubh(i64, i64) +define i64 @A2_vsubh(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vsubh(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vsubh(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vsubhs(i64, i64) +define i64 @A2_vsubhs(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vsubhs(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vsubh(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.A2.vsubuhs(i64, i64) +define i64 @A2_vsubuhs(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vsubuhs(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vsubuh(r1:0, r3:2):sat + +; Vector subtract bytes +declare i64 @llvm.hexagon.A2.vsubub(i64, i64) +define i64 @A2_vsubub(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vsubub(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vsubub(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vsububs(i64, i64) +define i64 @A2_vsububs(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vsububs(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vsubub(r1:0, r3:2):sat + +; Vector subtract words +declare i64 @llvm.hexagon.A2.vsubw(i64, i64) +define i64 @A2_vsubw(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vsubw(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vsubw(r1:0, r3:2) + +declare i64 @llvm.hexagon.A2.vsubws(i64, i64) +define i64 @A2_vsubws(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.A2.vsubws(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vsubw(r1:0, r3:2):sat -- 2.7.4