Skip to content
Snippets Groups Projects
  • Iain Buclaw's avatar
    51af8a64
    d: vector float comparison doesn't result in 0 or -1 [PR108945] · 51af8a64
    Iain Buclaw authored
    When comparing two vectors, the type of vector was used as the result of
    the condition result.  This meant that for floating point comparisons,
    each value would either be `0.0' or `-1.0' reinterpreted as an integer,
    not the expected integral bitmask values `0' and `-1'.
    
    Instead, use the comparison type determined by truth_type_for as the
    result of the comparison.  If a reinterpret is later required by the
    final conversion for generating CmpExp, it is still only going to
    reinterpret one integer kind as another.
    
    	PR d/108945
    
    gcc/d/ChangeLog:
    
    	* d-codegen.cc (build_boolop): Evaluate vector comparison as
    	the truth_type_for vector type.
    
    gcc/testsuite/ChangeLog:
    
    	* gdc.dg/pr108945.d: New test.
    51af8a64
    History
    d: vector float comparison doesn't result in 0 or -1 [PR108945]
    Iain Buclaw authored
    When comparing two vectors, the type of vector was used as the result of
    the condition result.  This meant that for floating point comparisons,
    each value would either be `0.0' or `-1.0' reinterpreted as an integer,
    not the expected integral bitmask values `0' and `-1'.
    
    Instead, use the comparison type determined by truth_type_for as the
    result of the comparison.  If a reinterpret is later required by the
    final conversion for generating CmpExp, it is still only going to
    reinterpret one integer kind as another.
    
    	PR d/108945
    
    gcc/d/ChangeLog:
    
    	* d-codegen.cc (build_boolop): Evaluate vector comparison as
    	the truth_type_for vector type.
    
    gcc/testsuite/ChangeLog:
    
    	* gdc.dg/pr108945.d: New test.