Skip to content

Commit

Permalink
X86: Make sure we account for the FMA4 register immediate value, othe…
Browse files Browse the repository at this point in the history
…rwise rip-rel relocations will be off by one byte.

PR15040.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173176 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Jan 22, 2013
1 parent 9dd2a3b commit 341c5fb
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Target/X86/X86InstrFormats.td
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
// FMA4 Instruction Templates
class FMA4<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern, InstrItinClass itin = IIC_DEFAULT>
: I<o, F, outs, ins, asm, pattern, itin>, TA,
: Ii8<o, F, outs, ins, asm, pattern, itin>, TA,
OpSize, VEX_4V, VEX_I8IMM, Requires<[HasFMA4]>;

// XOP 2, 3 and 4 Operand Instruction Template
Expand Down
61 changes: 61 additions & 0 deletions test/MC/X86/x86_64-fma4-encoding.s
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,67 @@
// CHECK: encoding: [0xc4,0xe3,0xfd,0x69,0xc2,0x10]
vfmaddpd %ymm2, %ymm1, %ymm0, %ymm0

// PR15040
// CHECK: vfmaddss foo(%rip), %xmm1, %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0xf9,0x6a,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddss foo(%rip), %xmm1, %xmm0, %xmm0

// CHECK: vfmaddss %xmm1, foo(%rip), %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0x79,0x6a,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddss %xmm1, foo(%rip),%xmm0, %xmm0

// CHECK: vfmaddsd foo(%rip), %xmm1, %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0xf9,0x6b,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddsd foo(%rip), %xmm1, %xmm0, %xmm0

// CHECK: vfmaddsd %xmm1, foo(%rip), %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0x79,0x6b,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddsd %xmm1, foo(%rip),%xmm0, %xmm0

// CHECK: vfmaddps foo(%rip), %xmm1, %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0xf9,0x68,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddps foo(%rip), %xmm1, %xmm0, %xmm0

// CHECK: vfmaddps %xmm1, foo(%rip), %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0x79,0x68,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddps %xmm1, foo(%rip),%xmm0, %xmm0

// CHECK: vfmaddpd foo(%rip), %xmm1, %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0xf9,0x69,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddpd foo(%rip), %xmm1, %xmm0, %xmm0

// CHECK: vfmaddpd %xmm1, foo(%rip), %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0x79,0x69,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddpd %xmm1, foo(%rip),%xmm0, %xmm0

// CHECK: vfmaddps foo(%rip), %ymm1, %ymm0, %ymm0
// CHECK: encoding: [0xc4,0xe3,0xfd,0x68,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddps foo(%rip), %ymm1, %ymm0, %ymm0

// CHECK: vfmaddps %ymm1, foo(%rip), %ymm0, %ymm0
// CHECK: encoding: [0xc4,0xe3,0x7d,0x68,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddps %ymm1, foo(%rip),%ymm0, %ymm0

// CHECK: vfmaddpd foo(%rip), %ymm1, %ymm0, %ymm0
// CHECK: encoding: [0xc4,0xe3,0xfd,0x69,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddpd foo(%rip), %ymm1, %ymm0, %ymm0

// CHECK: vfmaddpd %ymm1, foo(%rip), %ymm0, %ymm0
// CHECK: encoding: [0xc4,0xe3,0x7d,0x69,0x05,A,A,A,A,0x10]
// CHECK: fixup A - offset: 5, value: foo-5, kind: reloc_riprel_4byte
vfmaddpd %ymm1, foo(%rip),%ymm0, %ymm0

// vfmsub
// CHECK: vfmsubss (%rcx), %xmm1, %xmm0, %xmm0
// CHECK: encoding: [0xc4,0xe3,0xf9,0x6e,0x01,0x10]
Expand Down

0 comments on commit 341c5fb

Please sign in to comment.