Skip to content
Snippets Groups Projects
  • Xi Ruoyao's avatar
    87acfc36
    LoongArch: Provide fmin/fmax RTL pattern for vectors · 87acfc36
    Xi Ruoyao authored
    We already had smin/smax RTL pattern using vfmin/vfmax instructions.
    But for smin/smax, it's unspecified what will happen if either operand
    contains any NaN operands.  So we would not vectorize the loop with
    -fno-finite-math-only (the default for all optimization levels expect
    -Ofast).
    
    But, LoongArch vfmin/vfmax instruction is IEEE-754-2008 conformant so we
    can also use them and vectorize the loop.
    
    gcc/ChangeLog:
    
    	* config/loongarch/simd.md (fmax<mode>3): New define_insn.
    	(fmin<mode>3): Likewise.
    	(reduc_fmax_scal_<mode>3): New define_expand.
    	(reduc_fmin_scal_<mode>3): Likewise.
    
    gcc/testsuite/ChangeLog:
    
    	* gcc.target/loongarch/vfmax-vfmin.c: New test.
    LoongArch: Provide fmin/fmax RTL pattern for vectors
    Xi Ruoyao authored
    We already had smin/smax RTL pattern using vfmin/vfmax instructions.
    But for smin/smax, it's unspecified what will happen if either operand
    contains any NaN operands.  So we would not vectorize the loop with
    -fno-finite-math-only (the default for all optimization levels expect
    -Ofast).
    
    But, LoongArch vfmin/vfmax instruction is IEEE-754-2008 conformant so we
    can also use them and vectorize the loop.
    
    gcc/ChangeLog:
    
    	* config/loongarch/simd.md (fmax<mode>3): New define_insn.
    	(fmin<mode>3): Likewise.
    	(reduc_fmax_scal_<mode>3): New define_expand.
    	(reduc_fmin_scal_<mode>3): Likewise.
    
    gcc/testsuite/ChangeLog:
    
    	* gcc.target/loongarch/vfmax-vfmin.c: New test.