Skip to content

Wrong code for i288 addition #3773

@llvmbot

Description

@llvmbot
Bugzilla Link 3401
Resolution FIXED
Resolved on Jan 31, 2009 09:51
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @lattner,@sunfishcode

Extended Description

LLVM 2.6svn, x86 code generation.

Here's a small test program:

define void @​add(i288, i288, i288*) {
_L1:
%3 = add i288 %0, %1
store i288 %3, i288* %2
ret void
}

And some C code to test it:

#include <stdio.h>

#define N 9

struct big { unsigned int x[N]; };

void add(struct big, struct big, struct big *);

main()
{
struct big a, b, c;
int i;
for (i = 0; i < N; i++) {
a.x[i] = 0x11111111;
b.x[i] = 0x22222222;
c.x[i] = 0x5a5a5a5a;
}
add(a,b,&c);
for (i = N-1; i >= 0; i--)
printf("%08x ", c.x[i]);
printf("\n");
}

This prints
fffffffe 00000000 00000001 ffffffff ffffffff ffffffff ffffffff fffffffe 33333333
which is clearly wrong. Changing i288 to i256 (and N to 8) makes it work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions