From 88869cb4db2203f36f1b11515a8dd6cea1480ec8 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Tue, 20 Jul 2010 00:11:13 +0000 Subject: [PATCH] Add AVX vbroadcast new instruction llvm-svn: 108788 --- lib/Target/X86/X86InstrFormats.td | 9 +++++++++ lib/Target/X86/X86InstrSSE.td | 19 +++++++++++++++++++ test/MC/AsmParser/X86/x86_64-encoding.s | 16 ++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/lib/Target/X86/X86InstrFormats.td b/lib/Target/X86/X86InstrFormats.td index cc3fdf1efd7..d8872bc5495 100644 --- a/lib/Target/X86/X86InstrFormats.td +++ b/lib/Target/X86/X86InstrFormats.td @@ -411,6 +411,15 @@ class SS42AI o, Format F, dag outs, dag ins, string asm, : Ii8, TA, Requires<[HasSSE42]>; +// AVX Instruction Templates: +// Instructions introduced in AVX (no SSE equivalent forms) +// +// AVX8I - AVX instructions with T8 and OpSize prefix. +class AVX8I o, Format F, dag outs, dag ins, string asm, + list pattern> + : I, T8, OpSize, + Requires<[HasAVX]>; + // AES Instruction Templates: // // AES8I diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index 37ae188d43f..d0e3b42a399 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -4980,3 +4980,22 @@ def AESKEYGENASSIST128rm : AESAI<0xDF, MRMSrcMem, (outs VR128:$dst), (int_x86_aesni_aeskeygenassist (bitconvert (memopv2i64 addr:$src1)), imm:$src2))]>, OpSize; + +//===----------------------------------------------------------------------===// +// AVX Instructions +//===----------------------------------------------------------------------===// + +let isAsmParserOnly = 1 in { + +// Load from memory and broadcast to all elements of the destination operand +class avx_broadcast opc, string OpcodeStr, RegisterClass RC, + X86MemOperand x86memop> : + AVX8I, VEX; + +def VBROADCASTSS : avx_broadcast<0x18, "vbroadcastss", VR128, f32mem>; +def VBROADCASTSSY : avx_broadcast<0x18, "vbroadcastss", VR256, f32mem>; +def VBROADCASTSD : avx_broadcast<0x19, "vbroadcastsd", VR256, f64mem>; +def VBROADCASTF128 : avx_broadcast<0x1A, "vbroadcastf128", VR256, f128mem>; + +} // isAsmParserOnly diff --git a/test/MC/AsmParser/X86/x86_64-encoding.s b/test/MC/AsmParser/X86/x86_64-encoding.s index 6fce2c1f0de..b64bafedef7 100644 --- a/test/MC/AsmParser/X86/x86_64-encoding.s +++ b/test/MC/AsmParser/X86/x86_64-encoding.s @@ -3072,3 +3072,19 @@ pshufb CPI1_0(%rip), %xmm1 // CHECK: encoding: [0xc4,0x63,0x2d,0x40,0x18,0x03] vdpps $3, (%rax), %ymm10, %ymm11 +// CHECK: vbroadcastf128 (%rax), %ymm12 +// CHECK: encoding: [0xc4,0x62,0x7d,0x1a,0x20] + vbroadcastf128 (%rax), %ymm12 + +// CHECK: vbroadcastsd (%rax), %ymm12 +// CHECK: encoding: [0xc4,0x62,0x7d,0x19,0x20] + vbroadcastsd (%rax), %ymm12 + +// CHECK: vbroadcastss (%rax), %xmm12 +// CHECK: encoding: [0xc4,0x62,0x79,0x18,0x20] + vbroadcastss (%rax), %xmm12 + +// CHECK: vbroadcastss (%rax), %ymm12 +// CHECK: encoding: [0xc4,0x62,0x7d,0x18,0x20] + vbroadcastss (%rax), %ymm12 +