Commit Graph

162 Commits

Author SHA1 Message Date
H. Peter Anvin
22098d3618 test/imul.asm: remove obsolete ERROR marker
Error already fixed...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-07 16:53:49 -07:00
H. Peter Anvin
e831d67cec Test for various IMUL patterns
Test for IMUL patterns.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-07 11:28:29 -07:00
H. Peter Anvin
65feb5ae33 Add missing IMUL pattern: reg64,imm8
Make "imul rax,byte 5" work as expected.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-07 11:26:41 -07:00
H. Peter Anvin
588df78b0d New opcode for 32->64 bit sign-extended immediate with warning
Add a new opcode for 32->64 bit sign-extended immediate, with warning
on the number not matching.

This unfortunately calls for an audit of all the \4[0123] opcodes, if
they should be replaced by \25[4567].  This only replaces one
instruction (MOV reg64,imm32); other instructions need to be
considered.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-07 10:05:10 -07:00
H. Peter Anvin
f70fce6cc9 test/immwarn.asm: add a few more non-warning tests
A few non-warning conditions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-07 09:59:18 -07:00
H. Peter Anvin
98a22a65c0 Avoid double warning for signed dword immediate
Avoid double warning for the case where a signed dword immediate is
incorrectly extended to 64 bits.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-06 23:49:01 -07:00
H. Peter Anvin
c1377e9a98 New opcodes to deal with 8-bit immediate sign extended to opsize
New opcodes to deal with 8-bit immediates which are then sign-extended
to the operand size.  These allow us to warn appropriately.
Not sure I'm using these in all the proper places; need audit of all
uses of the \14..\17 opcodes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-06 23:40:31 -07:00
H. Peter Anvin
9f8171317d BR 2148448: Fix RIP-relative addressing with an immediate
When there is an immediate in the instruction, a RIP-relative offset
may not be relative to the end of the offset itself, since it is
relative to the end of the *instruction*, not the end of the *offset*.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-06 19:11:07 -07:00
H. Peter Anvin
a9ed99bddf immwarn: more immediate warnings test, with notes of where we fail
More tests for immediate warnings, with notes for the ones where we
currently fail to do the right thing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-06 18:49:00 -07:00
H. Peter Anvin
733cbb3197 test: change .stdout/.stderr to stdout/stderr
Using hidden files are rather antisocial, and rather pointless in this
particular context.  Change .stdout and .stderr to simply stdout and
stderr.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-06 18:28:42 -07:00
H. Peter Anvin
1755a719a4 test/br2148476.asm: comprehensive test of the CVT* instructions
Do a best attempt at a comprehensive test of the various CVT* SSE
instructions.  This includes the bug of BR 2148476.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-06 17:57:18 -07:00
H. Peter Anvin
9ac2b843b4 test/immwarn.asm: new test for immediate warnings
Test for various conditions that should or should not generate
immediate warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-05 19:41:32 -07:00
H. Peter Anvin
1b221bed25 test/Makefile: rule to run performtest --diff
Rule to run performtest with the --diff option.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-04 22:02:44 -07:00
H. Peter Anvin
9c209cc256 performtest: use -u with diff
Unified diffs are the only sane option.  When calling diff, pass the
-u option.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-04 22:01:42 -07:00
H. Peter Anvin
13d9d869a5 test/Makefile: add rules for the automatic tests
Add Makefile rules to run the automatic tests.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-04 21:59:38 -07:00
Victor van den Elzen
fd49408ed9 Already aligned aligns should be 0 bytes, not %1. 2008-10-01 13:21:02 +02:00
Victor van den Elzen
4c9d6220b4 Apply patch from BR 890790 2008-10-01 13:09:27 +02:00
H. Peter Anvin
0819e3b9a7 Add more 64-bit jump tests 2008-09-25 23:45:20 -07:00
H. Peter Anvin
2c8ad285fd Clean up unterminated lines 2008-09-25 02:33:24 -07:00
H. Peter Anvin
152656f8d3 Actually make non-power-of-2 alignments work
We can't use ($$-$) % (%1) since the wraparound will be wrong except
for powers of 2.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-25 02:31:50 -07:00
H. Peter Anvin
9ebf2cb938 test/fwdoptpp: test %error, %warning, %fatal
Test all of %error, %warning, and %fatal.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-24 00:30:46 -07:00
H. Peter Anvin
8e3f75ea6e %error, %warning out on the final pass, add %fatal
Only process %error or %warning directives on the final pass.  Add a
new %fatal directive which terminates assembly immediately.
2008-09-24 00:21:58 -07:00
H. Peter Anvin
0af3e7ed3c test: test for code that relies on the optimizer to be valid
There exists a fair bit of code out there which relies on the
optimizer in order to fit inside a predefined envelope.  NASM 2.04rc4
breaks this; write a simple test to demonstrate.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-23 17:09:52 -07:00
Victor van den Elzen
3b404c0f6b BR 1239818 - handle multiple %else clauses
Using multiple %else clauses or mixing %else and %elif
caused strange results.
Warn about it and produce sensible results.
2008-09-18 13:51:36 +02:00
Victor van den Elzen
28f4634634 Remove obsolete ROL-EQU hack
Now that there is proper forward reference resolution,
we can get rid of this junk. Wiping the flags also
removed the SBYTEnn flags, causing

cmp eax, a-b
a: nop
b:

to assemble with -Ox like

cmp eax, strict dword -1

This is now fixed.
2008-09-11 13:14:23 +02:00
H. Peter Anvin
5c10c17ba0 test/new: clean up whitespace 2008-08-29 18:04:16 -07:00
H. Peter Anvin
1c7cb9e28c Script to create new test case boilerplate 2008-08-29 17:27:00 -07:00
H. Peter Anvin
163e5874d9 Accept implicit memory size for VMREAD/VMWRITE 2008-08-28 18:05:23 -07:00
H. Peter Anvin
5e7d6f1105 BR 2029472: Wrong operand size for VMREAD/VMWRITE in 64-bit mode
Fix the operand size for VMREAD/VMWRITE in 64-bit mode
2008-08-28 18:03:49 -07:00
H. Peter Anvin
dd1de39ece BR 2028995: Missing MOVNTI m64, r64
Fix MOVNTI with a 64-bit argument.
2008-08-28 17:54:55 -07:00
H. Peter Anvin
3ba3af3290 Testcase for XCRYPT 2008-08-28 17:48:34 -07:00
H. Peter Anvin
7b4dc622c6 BR 2039212: Handle indirect far jumps in 64-bit mode
Handle indirect far jumps in 64-bit mode.  Default to 64 bit unless
overridden, for consistency with other jumps.
2008-08-28 17:35:25 -07:00
H. Peter Anvin
dace226187 test: Fix file with no final newline
Fix test/br2030823.asm, which had no final newline.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-08-24 18:17:09 -07:00
H. Peter Anvin
2a09b3bf11 BR 2030823: Problem with the 256-bit FMA instructions
Fix the 256-bit FMA instructions per bug report.
2008-08-13 16:25:08 -07:00
Victor van den Elzen
a21194646a minor bugfix in performtest.pl 2008-08-06 15:15:01 +02:00
Victor van den Elzen
22343c2c72 Add macro-defaults warning class and documentation. 2008-08-06 14:48:55 +02:00
H. Peter Anvin
932de6c252 BR 2034542: fix crash when touching __FILE__
Touching __FILE__ would cause a dereference of an uninitialized
pointer.  Fix.
2008-07-31 18:46:11 -07:00
Victor van den Elzen
0e857f1fe5 Improve checking and documentation for %ifctx 2008-07-23 13:21:29 +02:00
H. Peter Anvin
289ff7e2a8 BR 2003451: add test case
Add test case for BR 2003451: forwardness leakage between operands.
2008-07-19 21:40:07 -07:00
Slavik Gnatenko
1b67bd25b2 BR 2010180: outobj: Garbage may be written in a last PUBDEF
The testcase illustrates the problem. After "nasm -f obj
alonesym.nasm"
let's look to dump:

======
PUBDEF386(91) recnum:5, offset:0000005bh, len:03f9h, chksum:bbh(bb)
Group: 0, Seg: 1
00020000h - 'sym0000' Type:0
00020004h - 'sym0001' Type:0
....
00020134h - 'sym0077' Type:0

PUBDEF(90) recnum:6, offset:00000457h, len:000ah, chksum:b6h(b6)
Group: 0, Seg: 1
00000138h - 's' Type:2
0000b600h - '' Type:0
======

The problem is while 's' offset is 20138h it is marked as type 90h not
91h.  The root cause is located in obj_x():

static ObjRecord *obj_x(ObjRecord * orp, uint32_t val)
{
    if (orp->type & 1)
    	orp->x_size = 32;
    if (val > 0xFFFF)
        orp = obj_force(orp, 32);
    if (orp->x_size == 32)
        return (obj_dword(orp, val));
    orp->x_size = 16;
    return (obj_word(orp, val));
}

It sets up x_size and than writes data. In the testcase data are the
offset and this offset overflows a record. In this case the record is
emitted and its x_size is cleared. Because this is last PUBDEF the new
record with only 's' symbol is emitted also but its x_size is not 32
(it's still zero) so obj_fwrite doesn't switch to 91h type.

The problem seems to be very generic and expected to be occurred on
many other record types as well.

        ----

And the fix is simple:

if (orp->x_size == 32)
{
  ObjRecord * nxt = obj_dword(orp, val);
  nxt->x_size = 32; /* x_size is cleared when a record overflows */
  return nxt;
}
2008-07-19 19:27:41 -07:00
H. Peter Anvin
4fb7ed0566 test: more smart alignment test 2008-07-17 14:29:07 -07:00
H. Peter Anvin
f5975eead1 smartalign.mac: smart alignments macro package
"%use smartalign" followed by an optional "alignmode" can be used to
enable smart macros.
2008-07-16 14:41:39 -07:00
Victor van den Elzen
1f1f38bcd0 update tests 2008-07-16 12:20:26 +02:00
Victor van den Elzen
cabec40a39 Improve performtest.pl
Improve arguments and documentation of performtest.pl
Remove carriage returns in .stdout/.stderr so *nix can
read Windows test results
2008-07-16 12:20:21 +02:00
H. Peter Anvin
96a6954db4 BR 2017453: indirect jumps in 64-bit mode are implicitly 64 bits
Indirect jumps in 64-bit mode implicitly have 64-bit operand size.
Fix this; the disassembly is still unnecessarily ugly, however.
2008-07-13 15:21:01 -07:00
H. Peter Anvin
570b1c12b6 test: add test of nested %rep, BCD constants, and %warning
Add a test case which has smoked out errors in the handling of nested
%rep, BCD constants, and %warning...
2008-07-13 15:06:55 -07:00
H. Peter Anvin
514c8de2a3 test: simple test of packed BCD. 2008-07-03 20:16:40 -07:00
H. Peter Anvin
a676075b51 test: add a test for %imacro
Add a test for case-insensitive matching of %imacro.
2008-06-28 18:32:16 -07:00
H. Peter Anvin
6f4252afea utf.asm: add some error cases
Add some error cases for testing
2008-06-15 17:53:12 -07:00
H. Peter Anvin
9c749101ef Support __utf16__ and __utf32__ in an expression context
Support __utf16__ and __utf32__ in expression contexts.
2008-06-14 21:08:38 -07:00