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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to