[LLVMbugs] [Bug 9347] New: incorrect result type AltiVec vector comparison

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 28 16:39:21 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9347

           Summary: incorrect result type AltiVec vector comparison
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tonic at nondot.org
                CC: llvmbugs at cs.uiuc.edu


Given the following example:

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef __attribute__((ext_vector_type(8)))  uint8_t uint8x8_t;
typedef __attribute__((ext_vector_type(8)))  int8_t int8x8_t;

uint8x8_t foo(int8x8_t __a, int8x8_t __b) { \
  return (uint8x8_t)(__a == __b); }

The expression (__a == __b) should return a vector of 8 chars, but right now,
clang believe that it should returns an int (or bool if C++).

This is due to the following code in Sema::CheckVectorCompareOperands():
  // If AltiVec, the comparison results in a numeric type, i.e.
  // bool for C++, int for C
  if (getLangOptions().AltiVec)
    return Context.getLogicalOperationType();

I do not believe this is correct. Removing this condition allows the expression
type to be set correctly.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list