Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1230909

Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions inline

From Joakim Tjernlund <joakim.tjernlund@transmode.se>
Newsgroups linux.kernel
Subject Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions inline
Date 2015-09-22 22:10 +0200
Message-ID <qbC30-7gK-27@gated-at.bofh.it> (permalink)
References (2 earlier) <qbAkA-4J7-73@gated-at.bofh.it> <qbAXh-5tC-41@gated-at.bofh.it> <qbBzY-6tc-13@gated-at.bofh.it> <qbBTl-6Qf-43@gated-at.bofh.it> <qbBTl-6Qf-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> > And generally the one proposing uglification-for-optimization should provide 
> > the evidence. :-)
> 
> When it comes to gcc, past history is my evidence until proven otherwise :)
> Maybe I will check again ...

OK then:
static inline void mb(void)
{
       __asm__ __volatile__ ("sync" : : : "memory");
}

static inline void dcbf(void *addr)
{
       __asm__ __volatile__ ("dcbf 0, %0" : : "r"(addr) : "memory");
}
#define L1_CACHE_SHIFT 5
#define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
void flush_dcache_range(unsigned long start, unsigned long stop)
{
       void *addr = (void *)(start & ~(L1_CACHE_BYTES - 1));
       unsigned int size = stop - (unsigned long)addr + (L1_CACHE_BYTES - 1);
       unsigned int i;

       for (i = 0; i < size >> L1_CACHE_SHIFT; i++, addr += L1_CACHE_BYTES)
               dcbf(addr);
       if (i)
               mb();   /* sync */
}

gives:
flush_dcache_range:
	stwu %r1,-16(%r1)
	rlwinm %r3,%r3,0,0,26
	addi %r4,%r4,31
	subf %r9,%r3,%r4
	srwi. %r10,%r9,5
	beq %cr0,.L1
	mtctr %r10
	.p2align 4,,15
.L4:
#APP
 # 8 "gccloop.c" 1
	dcbf 0, %r3
 # 0 "" 2
#NO_APP
	addi %r3,%r3,32
	bdnz .L4
#APP
 # 3 "gccloop.c" 1
	sync
 # 0 "" 2
#NO_APP
.L1:
	addi %r1,%r1,16
	blr

good enough :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 19:00 +0200
  Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Joakim Tjernlund <joakim.tjernlund@transmode.se> - 2015-09-22 20:20 +0200
    Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Scott Wood <scottwood@freescale.com> - 2015-09-22 21:00 +0200
      Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Joakim Tjernlund <joakim.tjernlund@transmode.se> - 2015-09-22 21:40 +0200
        Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Joakim Tjernlund <joakim.tjernlund@transmode.se> - 2015-09-22 22:00 +0200
          Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Joakim Tjernlund <joakim.tjernlund@transmode.se> - 2015-09-22 22:10 +0200
          Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Joakim Tjernlund <joakim.tjernlund@transmode.se> - 2015-09-22 22:40 +0200
            Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 23:00 +0200
              Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-23 00:50 +0200
          Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Joakim Tjernlund <joakim.tjernlund@transmode.se> - 2015-09-22 22:40 +0200
  Re: [PATCH v2 22/25] powerpc32: move xxxxx_dcache_range() functions  inline Scott Wood <scottwood@freescale.com> - 2015-09-29 02:30 +0200

csiph-web